Excellent introduction to NSubstitue! Not only are your explanations pedagogical, but you also communicate clear and concise intent & flow of information with your code - clear code which speaks for itself. Well done.
Totally agree that the code looks very clean. I have just started a new project and I am considering to rewrite all my tests using NSubstituite. Keep it up the good job!
great intro in the framework. But I can't help myself: what most unit test demos show is, that the 1.) the compiler and the framework works 2.) the author can duplicate the behavior in its code into a unit test or the other way around. I would only test stuff that is really of interest. In this case the most important test would be that calling the hand crafted SQL code (which can not be verified at compile time) at least executes and that it executes with a reasonable performance. Unit tests and test driven development should be performed, if only for the reason, that it makes testing new code SO much more efficient. But I can see those management slides that show that we have 10.000 unit test with 1.000.000 lines of code - which suggest the quality has to be great. But it actually doesn't. The tests need to go to the interesting parts and not just consist of a bloat of trivial stuff.
Totally agree. You should test major behaviors, not minor implementation details. The tests shown in the video are basically useless. But they serve as a demo of the framework, which was the intention here of course.
I'm new to NSubstitue (coming from Moq), the basic concepts are very well explained, congrats. But I would like you to share your approach on mocking HttpClient because as far as I found out this is not a straight forward process. Thanks for the video.
Hey mate, great video. You should've explained all the CRUD process, not just the read, that would've been awesome mate. Could you please make a video explaining how to mock the Create and delete process?
Nice job Nick, I am wondering how to unit-test transactions in Entity Framework Core with NSubstitute or Moq when I am trying to unit-test a method that include code with _context.BeginTranscnction( ) ?
Hello, you recently reply to my comment about the triple a's. I manage to create a snipped but when I insert the snipped, the first line is formatted correctly but the "// act" and "//Assert" are inserted at beginning of the line, in other word these lines doesn't get formatted.
Great video! One question: how would you pass the Nsubstitute dependencies to your system under test if the SUT were to be instantiated using IClassFixture for parallelization of the test execution?
Hey Nick, Thank you so much for these videos. You really make developers better and more efficient. I have a question on this, Will NSubstitute work with a Refit Interface which doesn't have an in house implementation? Could you clarify on that? I am breaking my head unit testing Refit interfaces with Moq and it doesn't work for me. Thanks in advance!
@@nickchapsas Thank you. I've always had a QA team test my application. Now I'm trying to wrap my head around writing Unit Testing but I can't seem to understand testing DB CRUD operation. I understand to test my application algorithm but testing DB CRUD operation just confuses me.
Are you looking for more training? Check out my "From Zero to Hero: Unit testing in C#" course: nickchapsas.com/p/from-zero-to-hero-unit-testing-in-c
can you share a disccount code may I ask? Thanks.
Excellent introduction to NSubstitue! Not only are your explanations pedagogical, but you also communicate clear and concise intent & flow of information with your code - clear code which speaks for itself. Well done.
I'm just amazed from clear syntax of NSubstitute. Thanks for the video
20 minutes of great training. No fluff, no BS, just enough to solve my problem.
Totally agree that the code looks very clean. I have just started a new project and I am considering to rewrite all my tests using NSubstituite. Keep it up the good job!
Very nice mocking framework. I'm going to try it and probably use it from now on.
Wow, your presentation has changed so much since you did this video. Still, very informational in light of current events.
great intro in the framework. But I can't help myself: what most unit test demos show is, that the 1.) the compiler and the framework works 2.) the author can duplicate the behavior in its code into a unit test or the other way around. I would only test stuff that is really of interest. In this case the most important test would be that calling the hand crafted SQL code (which can not be verified at compile time) at least executes and that it executes with a reasonable performance. Unit tests and test driven development should be performed, if only for the reason, that it makes testing new code SO much more efficient. But I can see those management slides that show that we have 10.000 unit test with 1.000.000 lines of code - which suggest the quality has to be great. But it actually doesn't. The tests need to go to the interesting parts and not just consist of a bloat of trivial stuff.
Totally agree. You should test major behaviors, not minor implementation details. The tests shown in the video are basically useless. But they serve as a demo of the framework, which was the intention here of course.
This is awesome! Thank you for a great video on Nsubstitute and mocking
AutoSubstitution with Theories makes testing so much nicer.
I'm new to NSubstitue (coming from Moq), the basic concepts are very well explained, congrats. But I would like you to share your approach on mocking HttpClient because as far as I found out this is not a straight forward process. Thanks for the video.
Thank you, Sir! Clear, concise and well explained.
Hey mate, great video.
You should've explained all the CRUD process, not just the read, that would've been awesome mate.
Could you please make a video explaining how to mock the Create and delete process?
Excellent video, Thank You.
This is useful, I will try it tomorrow
Nice job Nick, I am wondering how to unit-test transactions in Entity Framework Core with NSubstitute or Moq when I am trying to unit-test a method that include code with _context.BeginTranscnction( ) ?
How to test protected methods?
Hi ....is there any way to mock a static method without writing a wrapper or changing the code flow?
Is it possible for data access methods in ado.net
Can we used the solution for NUnit?
What should do I if I have extension methods (third party library) inside a method that I want to test?
Hello, you recently reply to my comment about the triple a's.
I manage to create a snipped but when I insert the snipped, the first line is formatted correctly but the "// act" and "//Assert" are inserted at beginning of the line, in other word these lines doesn't get formatted.
@Nick Is there a way to test a public access modifier method that has a private access modifier method or static method inside itself?
Hi, do you have any sample using Nsubstitute in VB.NET? Thanks for sharing. Best regards!
GREAT VIDEO. THANK YOU SO MUCH !!
Great video! One question: how would you pass the Nsubstitute dependencies to your system under test if the SUT were to be instantiated using IClassFixture for parallelization of the test execution?
Awesome video.
Margarita Overpass
Thanks again!
Hey Nick, Thank you so much for these videos. You really make developers better and more efficient. I have a question on this, Will NSubstitute work with a Refit Interface which doesn't have an in house implementation? Could you clarify on that? I am breaking my head unit testing Refit interfaces with Moq and it doesn't work for me. Thanks in advance!
It would yes. I use Refit with NSubstitude and it works like any other interface.
@@nickchapsas Awesome, thank you!
Prediction: next video is about FluentAssertion :)
I don’t know if it’s gonna be the next one because I wanna cover FakeItEasy as well but it will probably be the one after the mocking ones
How can we get the source code ?? I desparatly need it.
The source code is available to my Patreons
Nick, did you upload this project to GitHub yet? Trying to look for it but can't find it.
Hey, it is uploaded under NugetPackageTutorials/MockingTutorial/CustomersApi.NSubstitute/
@@nickchapsas Thank you. I've always had a QA team test my application. Now I'm trying to wrap my head around writing Unit Testing but I can't seem to understand testing DB CRUD operation. I understand to test my application algorithm but testing DB CRUD operation just confuses me.
Man, I was waiting for you to write the test case for Create which you skipped.
came here hoping to learn how to use Returns on a void method.
hi looking for this source code in invited source
It is under NugetPackageTutorials/MockingTutorial/CustomersApi.NSubstitute/
@@nickchapsas I'm sorry I'm new to your channel, Where do I find this path which you have mentioned above?
Thank u