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.
@HarshaSuranjith
Жыл бұрын
Excatly what I was looking for, thanks for the great content.
@nataliasikorka4825
3 жыл бұрын
Great tutorial as always! Thank you for your work ^^
@RawCoding
3 жыл бұрын
Cheers)
@loam
Жыл бұрын
Also convinient option is to have database server running in docker container.
@krs-tube
4 ай бұрын
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?
@damientech88
3 жыл бұрын
Testing return values is easy. Testing a method which performs a whole bunch of tasks is where this falls over.
@RawCoding
3 жыл бұрын
Well you’ve pretty much resolved the problem in the 2nd sentence with the 1st
@damientech88
3 жыл бұрын
@@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.
@RawCoding
3 жыл бұрын
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.
@sgroxatdgp
8 ай бұрын
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 ?
@sunnypatel1045
3 жыл бұрын
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
@RawCoding
3 жыл бұрын
What do you mean collections? As in the tests them selfs?
@sunnypatel1045
3 жыл бұрын
@@RawCoding no not test just a video on different types of collections like the video you did with ienumerable
@RawCoding
3 жыл бұрын
Aha is there specific thing that you are confused about or why do you think you need a tutorial about that?
@sunnypatel1045
3 жыл бұрын
@@RawCoding it be a good reminder recently I looked at concurrent collections and sometimes I get confused on what each one does.
@semen083
Жыл бұрын
Hi, is any way way to make integration tests for WindowsService App?
@coder185
2 жыл бұрын
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?
@RawCoding
2 жыл бұрын
It’s hard to tell from that description. You can make methods virtual and have your mock override them and return dummy data
@rootsharp9946
2 жыл бұрын
So it's a unit test structure with integration testing functions. Is that it?
@RawCoding
2 жыл бұрын
Yes
@RoboChickenAnimation
3 жыл бұрын
can you do some videos on design patterns?
@RawCoding
3 жыл бұрын
We shall
@RoboChickenAnimation
3 жыл бұрын
@@RawCoding oo and possibly SOLID. Thanks so much
@algarud
3 жыл бұрын
Enough SOLID, roll GoF patterns on 🤪
@RoboChickenAnimation
3 жыл бұрын
@@algarud why not both?
@RawCoding
3 жыл бұрын
Can do both )
@speakoutloud7293
6 ай бұрын
Dude, your email notifications are making me crazy! I am not able to find my own emails.
@RawCoding
6 ай бұрын
Which emails?
@speakoutloud7293
6 ай бұрын
17:01 23:19 24:36 24:45 24:50 And probably more :p @@RawCoding
@user-mm7yy9cf5d
Жыл бұрын
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;
@clearlyunwell
3 жыл бұрын
👍🏽
@RawCoding
3 жыл бұрын
Cheers
@xieweiling7543
3 жыл бұрын
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?
@RawCoding
3 жыл бұрын
It’s coming son don’t worry
@xieweiling7543
3 жыл бұрын
@@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!
@RawCoding
3 жыл бұрын
We test the controller in this video, what kind of test do you have in mind?
@xieweiling7543
3 жыл бұрын
@@RawCoding like those http endpoints
@RawCoding
3 жыл бұрын
So you want to test via http call rather than calling a method?
@bramburn
2 жыл бұрын
Found it
@compman73
3 жыл бұрын
Good job Thank you but fast-paced teaching could not help much as we need to pause the video too many times
Пікірлер: 51