I would suggest moving set-up stage to a constructor to avoid having initialization code inside every test. xUnit creates a new instance of test class for every test, so that tests won't share any state between each other, but it saves you from a lot of boilerplaiting.
@nataliasikorka48254 жыл бұрын
Great tutorial as always! Thank you for your work ^^
@RawCoding4 жыл бұрын
Cheers)
@HarshaSuranjith Жыл бұрын
Excatly what I was looking for, thanks for the great content.
@krs-tube10 ай бұрын
Thank you @RawCoding, what have you used as reference if anything at all, for the conceptual understanding of integration testing and then potentially for the implementation?
@sgroxatdgp Жыл бұрын
I am testing something similar but I want to test a case with getting null data from my collection when there will be do data at the db collection. But as the tests running in parallel, my tests are overlapping and failing randomly. I have different class fixtures for these but all are accessing same db and collection. Is there any way to perform this without disabling the parallelisation ?
@sunnypatel10454 жыл бұрын
Brilliant job mate! I would like to make a small request. Could you do a video going through different collections like concurrent collection and async collections if that’s ok. Thanks
@RawCoding4 жыл бұрын
What do you mean collections? As in the tests them selfs?
@sunnypatel10454 жыл бұрын
@@RawCoding no not test just a video on different types of collections like the video you did with ienumerable
@RawCoding4 жыл бұрын
Aha is there specific thing that you are confused about or why do you think you need a tutorial about that?
@sunnypatel10454 жыл бұрын
@@RawCoding it be a good reminder recently I looked at concurrent collections and sometimes I get confused on what each one does.
@loam2 жыл бұрын
Also convinient option is to have database server running in docker container.
@damientech883 жыл бұрын
Testing return values is easy. Testing a method which performs a whole bunch of tasks is where this falls over.
@RawCoding3 жыл бұрын
Well you’ve pretty much resolved the problem in the 2nd sentence with the 1st
@damientech883 жыл бұрын
@@RawCoding Most things in the real world are not basic CRUD or return a nice value wrapped in a bow. At some point, all of your units need to be strung together to perform a complex task and that rarely can be tested by returning a simple value.
@RawCoding3 жыл бұрын
Clearly a mistake has been made if it’s not simple, but I’m aware that happens all the time, heck even I’ve lived through it countless times. Do check the next 2 videos where you can find more ‘complex’ examples, where I show how to test with identity mocking and I think it’s making sure emails gets sent to admins and managers.
@rootsharp99463 жыл бұрын
So it's a unit test structure with integration testing functions. Is that it?
@RawCoding3 жыл бұрын
Yes
@coder1852 жыл бұрын
How do i test methods that require httprequest results after a login from external sources => afterwards the test method calls a production database to save records. Is this kind of method untestable? I can't make the database in memory because the code in submethod defines the connectionstring and so on... Can i write tests for production environment?
@RawCoding2 жыл бұрын
It’s hard to tell from that description. You can make methods virtual and have your mock override them and return dummy data
@RoboChickenAnimation4 жыл бұрын
can you do some videos on design patterns?
@RawCoding4 жыл бұрын
We shall
@RoboChickenAnimation4 жыл бұрын
@@RawCoding oo and possibly SOLID. Thanks so much
@devjutsu4 жыл бұрын
Enough SOLID, roll GoF patterns on 🤪
@RoboChickenAnimation4 жыл бұрын
@@devjutsu why not both?
@RawCoding4 жыл бұрын
Can do both )
@xieweiling75434 жыл бұрын
It's an awesome tutorial, I am still not very clear, for example, how should we test an asp.net Core Web API? What can we mock?
@RawCoding4 жыл бұрын
It’s coming son don’t worry
@xieweiling75434 жыл бұрын
@@RawCoding That's exciting, recently I am building an asp.net core web api, I know I should create the test for the controller, but I don't really know how. Appreciate!
@RawCoding4 жыл бұрын
We test the controller in this video, what kind of test do you have in mind?
@xieweiling75434 жыл бұрын
@@RawCoding like those http endpoints
@RawCoding4 жыл бұрын
So you want to test via http call rather than calling a method?
@GZPlays_uno11 ай бұрын
Dude, your email notifications are making me crazy! I am not able to find my own emails.
@RawCoding11 ай бұрын
Which emails?
@GZPlays_uno11 ай бұрын
17:01 23:19 24:36 24:45 24:50 And probably more :p @@RawCoding
@PavloKhomiak Жыл бұрын
add this code to CreateDatabase() and forget for existing db exception bool exists; var commandExists = @$"select exists( SELECT datname FROM pg_catalog.pg_database WHERE lower(datname) = lower('{db}'));"; await using (var c = new NpgsqlCommand(commandExists, connection)) { exists = (bool) await c.ExecuteScalarAsync(); } if (exists) return;
@clearlyunwell3 жыл бұрын
👍🏽
@RawCoding3 жыл бұрын
Cheers
@compman733 жыл бұрын
Good job Thank you but fast-paced teaching could not help much as we need to pause the video too many times