Building a .NET 6 API Using TDD

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ก.ย. 2024

ความคิดเห็น • 172

  • @CripplingDuality
    @CripplingDuality 2 ปีที่แล้ว +35

    Your content is always worth the wait. I trust your goal is to teach TDD by practice with this series, but I do wonder if the world needs more demonstrations of RESTful APIs...maybe a graphql api or a grpc application in the future? Just a thought. Looking forward to this series!

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว +1

      great feedback. thanks Natesh!

    • @hackerprincess8810
      @hackerprincess8810 2 ปีที่แล้ว +8

      duh yes we do? The world still uses REST APIs in abundance and alot of us value diff content creators sharing how they go about teaching it.

    • @影片程式
      @影片程式 2 ปีที่แล้ว +2

      @@WesDoyle
      Can u provide a series of course about Unit Test for C# .
      Your course is really helpful, thanks !

    • @invictuz4803
      @invictuz4803 ปีที่แล้ว

      Better to focus content and teach one thing at a time.

    • @EduardoSanchez-un2hh
      @EduardoSanchez-un2hh ปีที่แล้ว +2

      Well, most Businesses hire devs to make or maintain RestApis.

  • @Veretax
    @Veretax ปีที่แล้ว +13

    This is quite possibly one of the best C# TDD examples, with an API/WebRequest I've seen on TH-cam.

  • @Greenthum6
    @Greenthum6 2 ปีที่แล้ว +29

    Thanks for the video! The code looks clean, but I want to give feedback to avoid pitfalls when going into more complex application testing:
    - Unit testing controllers is rarely necessary. This is a controversial topic, but I recommend keeping controller layer as a pass-through for example with mediator pattern and use integration tests to cover the controller code. When doing the design this way there is usually no need to mock anything, just use a real data storage for the tests instead. This makes understanding the code and debugging the failure much easier.
    - Test behavior, not implementation details. The main test here tests that a service calls an external API when calling the controller method. When testing the controller we are not interested how it gets the users, but the fact that it does so. Now the test is dependent on both controller and service interface code. When the service interface changes, the test breaks even though it will return the users correctly.
    - When considering the two issues above and the fact that we still need an integration test to make sure that the users are returned correctly to the caller we start to see why unit testing controllers is not a good idea.
    - Use setup (and teardown) methods to put shared initialization code into one place. The tests are almost the same and are already pretty long for what they do.
    - TDD is much wider concept than unit testing. I see TDD as a tool to test how the system should behave. You start the process before writing any actual production code. This is tough for development-oriented mind. It is easier to think about testing "did it return 404" or "was that method called" instead of "were the requested details of the users stored returned back to the caller correctly".
    The commentary, phasing and the code layout is good. Keep posting!

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว +3

      All great points, thanks for sharing. Hopefully I’ll make a follow up sharing integration and e2e tests with a larger codebase in the future. All the best 😀

    • @n0pee349
      @n0pee349 ปีที่แล้ว

      Hello @Greenthum6 I have a question about this statement: "When the service interface changes, the test breaks even though it will return the users correctly".
      Imagine we have sarvice A and this service uses service B. How would u write (unit) tests for service A, that will not breaks after changing interface of service B? Are you testing everything with a "balck box tests" (testing income and outcome) without mocking?
      You wrote that we should not unit test controllers because of integration/e2e tests are covering them. I disagree. Integration/e2e tests are the next layer of tests (they are testing how "integration" with 3-party software works) and they should not be the reason to not write unit tests.
      Can you help me by showing what I'm missing? I'm ready to change my mind.

    • @Greenthum6
      @Greenthum6 ปีที่แล้ว

      @Tantol You are probably confusing the scope of unit and integration tests. Integration tests are for testing two or more units together. Not only 3rd party, but also your own code components.
      In your example, testing services A and B together is essentially an integration test. If there is already an integration test for testing them together, what value does a unit test add?
      Controllers should have simple logic and only a very few code paths. You ideally want to test all those code paths with integration tests. Then again, unit tests don't add more value. If you only rely on unit tests, you can't be sure how your code works with the rest of the application.
      My advice is to start testing at the service level first and add unit tests where they add value. This helps to understand how your service works and how it solves the actual business problem.

    • @n0pee349
      @n0pee349 ปีที่แล้ว

      ​@@Greenthum6 "testing services A and B together is essentially an integration test" I meant not togheter. I meant testing only service A that uses service B that I'm mocking in ex.:
      I would test if my function X from service A calls function Y from service B by mocking and verifying if it was called. And now if I change interface code for service B my tests on service A will not work even if outcome of function Y is the same as before - "When the service interface changes, the test breaks even though it will return the users correctly" My function Y (from service B) still returns same users after interface change. How to test this scenario to prevent breaking tests after interface change?
      This is where I have struggle for service scenario.
      For controller scenario now I see your point that this makes no sens to write unit tests on top of integration tests (waste of time and money).
      But for me it dose not make sense when testing service with mocking. These tests will always break after interface change and those I call unit tests (I'm separating logic by mocking).
      Or mb. I misinterpreted you and that sentence was only meant with controller in mind? If so I have no more questions.

    • @Greenthum6
      @Greenthum6 ปีที่แล้ว +2

      @Tantol My response was mainly for controller testing. Unit testing a service does not make sense as you unit test only a part of it. When service B changes its interface, your unit test for service A still works since the mock is using the previous interface. When you update the production code in service A to newer service B your unit test may also break at build time, or it could just work depending on the mock code. Service interface changes should be rare, but unavoidable. If you have a lot of mocks there may be some manual rewriting needed. This is where an integration test is often better as it tests more the behavior than the implementation details. As a side note, I hate to read abundant mock code. It is really hard to understand later.

  • @WesDoyle
    @WesDoyle  2 ปีที่แล้ว +2

    Thanks for watching! What would you like to see next?

  • @VinuP2023
    @VinuP2023 2 ปีที่แล้ว +2

    Hi Wes!, glad to see you back
    We hope you create more videos this year..
    Its always great to learn from you😊

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว +1

      Hi Vinay Palaksha, thanks for the message! Lots of content planned for this year. All the best

  • @abhishekdube9004
    @abhishekdube9004 2 ปีที่แล้ว +4

    Hi Wes,
    This is really a great video and helped me a lot to gain a new perspective to approach a problem statement or requirement.
    You made me fall in love with the TDD approach :D
    I would really like to see how we can further use this approach to create loosely coupled architecture with a database (SQL / No SQL). Will we see more continuation of this video?

  • @2005Azm
    @2005Azm 2 ปีที่แล้ว +1

    I was waiting for this! Good to see you back!

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      Thanks! Great to hear from you. All the best

  • @chrisyapp3308
    @chrisyapp3308 2 ปีที่แล้ว +8

    Great video Wes! Glad to se your vids back!.. I just had one question though as I was following along, when you set up the mock HttpMessageHandler and then you created the overloaded function SetUpBasicGetResourceList(List expectedResponse, string endPoint), I noticed that at first you created a custom HttpRequestMessage obj, then passed that in as a parameter in to the handlerMock.Protected().SetUp() instead of using ItExpr.IsAny(), then at the end when the test failed and you returned to that Mock it was changed back to ItExpr.IsAny() and there wasnt a custom HttpRequestMessage obj being used... what did I miss? Keep up the content dude!

    • @vladdragomir2804
      @vladdragomir2804 ปีที่แล้ว +1

      Thank you so much for this comment! :)
      I kept searching where I deviated from the code and finally found this comment - saved me a lot of headaches!

  • @IgorTimarac
    @IgorTimarac ปีที่แล้ว +11

    Never return 404 instead of empty lists, it's a bad API design. Do return 404 for not found objects, though (e.g. for GET /users/42 when no user with the ID of 42 exists).

  • @girornsveinsson7970
    @girornsveinsson7970 2 ปีที่แล้ว +6

    Thanks for a great video. I have kind of the same question as Cris Yapp though. It looks like you changed SetupBasicGetResourceList(List expectedResponse, string endpoint) method off camera so there you are no longer using the endpoint parameter. When left unchanged the test will fail for reasons I do not understand, even though the UsersService is not harcoded with the foo endpoint but using the config. It would be great to get some explanations for this.

    • @fatihgenc7385
      @fatihgenc7385 2 ปีที่แล้ว +3

      Yes, actually I think it was an unnecessary parameter even at beginning, we are giving endpoint to conf ( options ) then giving it to UserService through constructor, that means it will request to endpoint we give, no need to give it also at the mockhandler method call. I guess he noticed and changed it but forgot the record or editing video.

  • @damianfijoek2037
    @damianfijoek2037 2 ปีที่แล้ว +5

    53:27 to remove all the unnecessary usings you can just press ctrl + k + e. Also, instead of replacing positions of brackets, you can set in IDE how ctrl + k +d should place them

    • @FabioGalanteMans
      @FabioGalanteMans 2 ปีที่แล้ว +1

      ctrl + r + g

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว +1

      thanks! i’m using a combination of vim and resharper keybindings

    • @stevehiggin
      @stevehiggin 2 ปีที่แล้ว +5

      Please do not place { on the same line as the method, thats nots the dotnet way 🤣…

    • @sudidav
      @sudidav 2 ปีที่แล้ว +3

      @@stevehiggin it seems weird to have that in C#.🤣🤣

  • @ryadean
    @ryadean 2 ปีที่แล้ว +1

    Welcome back Wes, hope you are well. Strangely I was on your channel the other day and was wondering where you had gone!

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      Thanks for the message Ryan! More to come!

  • @Kudaty1407
    @Kudaty1407 10 หลายเดือนก่อน +1

    I think I understand the most of ot, but I will have to retake that lesson later becasue the part about MockHttpRequest is a little bit too fast and complicated for me. I need to disassemble it into smaller pieces :D
    Great video though!
    But im my opinion there are things that you should change a bit :
    -Go a little slower, I had to stop the recording several times in order to find myself and catchup.
    -you should Go more into details, because you go like " I do that, and then that" bo no explenation why etc.
    - sometimes you just click stuff really fast without additional comments. That would also be nice :)

  • @martinrohwedder6618
    @martinrohwedder6618 ปีที่แล้ว +6

    Out of curiosity. Why do you create your project files using the command line, rather than just using Visual Studio GUI? BTW I love your video. Very educational :)

  • @TheYasieso
    @TheYasieso 2 ปีที่แล้ว +1

    Great you're back Wes!! And with great content, as always!!

  • @pedrofreitaslima
    @pedrofreitaslima 2 ปีที่แล้ว +1

    Thank you very much, your content help me because i need learn TDD and you taught very well now i can implement this patterns

  • @jephrennaicker4584
    @jephrennaicker4584 ปีที่แล้ว

    Great video, for beginners, shows how easy unit tests can be to how complex unit test could be

  • @javierolazaran7227
    @javierolazaran7227 2 ปีที่แล้ว +1

    Great to see you back! Great content as usual.

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      Thanks, Javier. Great to be back!

  • @zakitl6323
    @zakitl6323 2 ปีที่แล้ว +1

    Thank you Wes, we missed your videos😀

  • @eduardkoryagin4792
    @eduardkoryagin4792 2 ปีที่แล้ว +2

    Thanks a lot! Usually I decare tested class and mocks as local variables in test class and create it in constructor. In this case in test method all we have to do - setup mocks, execute method and do assert/verify. If we add new parameter into tested class constructor - refactoring is much easier.

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      Great insight on a nice way to set up tests, Eduard.Thanks!

  • @AayushRastogiKnowMe
    @AayushRastogiKnowMe 2 ปีที่แล้ว +1

    Very well explained Wes. Great work. I recently started watching your videos , and love them.

  • @rodrigo6459
    @rodrigo6459 2 ปีที่แล้ว +1

    PURE GOLD!!! Loved it!

  • @EduardoMartinez-dm5pp
    @EduardoMartinez-dm5pp ปีที่แล้ว

    I'd like to help out adding some hot keys and commands to make your coding even swifter:
    Edit a class or object's name and replace it in all its callings: -}> Ctrl + R + R
    Add a new file .cs (interface, class, etc) -}> ctrl + shift + A
    Open the Quick actions and refactorings: -}> Ctrl + . (dot)
    I'll keep adding more hot keys as I follow the video

  • @abbasfais
    @abbasfais ปีที่แล้ว

    A video on a web api/web dev project that is solid compliant would also be very much appreciated.

  • @superdev4024
    @superdev4024 ปีที่แล้ว +1

    Good explanation on TDD. thanks.

  • @geeksy2278
    @geeksy2278 2 ปีที่แล้ว +3

    Love it! Very cool! Can you make a video on how to become a .NET developer. In my area there are tons of jobs for .net and I would love to make the switch. Keep it up!

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว +1

      Great suggestion!

  • @sshado2
    @sshado2 2 ปีที่แล้ว +1

    This is such a valuable tutorial. Thank you so much.

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      Glad it was helpful!

  • @kitsurubami
    @kitsurubami ปีที่แล้ว

    This video is great! Thank you for making it for us. I'll definitely check out your other stuff.

  • @Mo-ef9yt
    @Mo-ef9yt 2 ปีที่แล้ว +1

    Hi Wes!
    Nice to have you back 🙂

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      Great to be back!

  • @danzaverdk
    @danzaverdk 2 ปีที่แล้ว +4

    hi wes!, just keep on doing what you are doing, honestly this channel needs more views, i learned alot from wes and will always learn more. thank you so much wes!

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      I appreciate that, Albert!

  • @muyiwaishola3196
    @muyiwaishola3196 2 ปีที่แล้ว +1

    Thanks for sharing, Wes!

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      Thanks for watching, Muyiwa Ishola!

  • @VladyslavHorbachov
    @VladyslavHorbachov ปีที่แล้ว +1

    Great example bro!

  • @heheh6345
    @heheh6345 2 ปีที่แล้ว +1

    Why the heck do you use Insert on your keyboard so much? Drives me crazy.
    Fantastic video though. Appreciate it a lot. Thanks!

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว +1

      I’m using vim

  • @jimmydavila7196
    @jimmydavila7196 2 ปีที่แล้ว +1

    Thank you Wes. Good tutorial as usual.

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      Glad it was helpful! Thanks Jimmy.

  • @miklosmoricz
    @miklosmoricz 2 ปีที่แล้ว +2

    Thumbs up! But I cannot really understand, why you fight againt your IDE in order to force Javascript-type bracket indentation. :)

  • @marktide4632
    @marktide4632 8 หลายเดือนก่อน

    Hi, I have some comments which are to help future tutorials. I managed to follow up to nearly the end and then boom all went pear shaped. Being a novice I have not the skills to work out the problems.
    My comments are, perhaps go a little slower, the keyboard clicking and the constant movement of your cursor for no reason is really distracting. It would be nice to have a resource file. Thus for people like me that have followed along but some where missed a key line and it goes wrong we would be able to look at the working code and see where we didn't follow your quick commentary close enough. I mean this by no means to be negative. :)
    Thanks for the video.

  • @ryanzwe
    @ryanzwe ปีที่แล้ว +2

    I'd love to see this done with NSubstitute

  • @zeldaire7484
    @zeldaire7484 ปีที่แล้ว

    Such an awesome and concise video.

  • @vuhoang5903
    @vuhoang5903 3 หลายเดือนก่อน

    Oh god, this is the exact tutor I need right now.

  • @saeed-ahmadvand
    @saeed-ahmadvand ปีที่แล้ว

    Thanks for sharing. This video was very useful for me.

  • @diegosramirez
    @diegosramirez 2 ปีที่แล้ว +1

    This is so useful! thank you!

  • @ahmedelgendy5363
    @ahmedelgendy5363 2 ปีที่แล้ว

    Thanks a lot I am now very interest to Apply the TDD Concept in my work.

  • @the_lucas
    @the_lucas 5 หลายเดือนก่อน

    The video is good.
    do you program with Java or javascrip? Why fight with visual studio adjusting the curly brackets 😅?

  • @simplepycodes
    @simplepycodes 2 ปีที่แล้ว +1

    Thanks a lot, very informative and helpful, perfect ..

  • @danielcarlstrom1981
    @danielcarlstrom1981 2 ปีที่แล้ว +2

    Thanks for this great video!
    I'm curious about what font / colors / theme settings you use for Visual Studio?
    Do you have some information on that somewhere? (new subscriber here)
    All the best!

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว +1

      Hi Daniel! I have a repo on my GitHub called dotfiles that contains settings for all of my tooling. All the best to you, thanks for subscribing!

  • @primavera919
    @primavera919 ปีที่แล้ว +2

    Hello, thank you for creating very educational content. I was wondering what is the console/termain you used in the beginning? The one with the tabbing options on top

  • @mohammaddaglas1984
    @mohammaddaglas1984 2 ปีที่แล้ว +1

    Thank you very much for the great content!

  • @amartinezldn
    @amartinezldn 4 หลายเดือนก่อน

    Great tutorial, thank you!

  • @alexwexov4298
    @alexwexov4298 2 ปีที่แล้ว

    Glad to see that you use the Vim plugin :)

  • @finnbenson1826
    @finnbenson1826 2 ปีที่แล้ว +1

    fantastic video
    thank you

  • @andydevtrost3587
    @andydevtrost3587 ปีที่แล้ว

    thanks for this awersome course .

  • @markozilkovskyi9338
    @markozilkovskyi9338 หลายเดือนก่อน

    hey, appreciate the video. what fonts are you using?

  • @milesvendetti-houser1889
    @milesvendetti-houser1889 2 ปีที่แล้ว +1

    AYYYY WES IS BACK!

  • @vladeb1104
    @vladeb1104 5 หลายเดือนก่อน

    hi - in this example tests of the external api takes a place - do you /have a video where you testing dbcontext? My application controllers are handling crud operations on existing db and its tables. I was wondering if you can show how to mock this type of scenario?

  • @josehuertas877
    @josehuertas877 2 ปีที่แล้ว +1

    Great video!

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      Thanks for watching!

  • @reidainutilidade8743
    @reidainutilidade8743 ปีที่แล้ว

    Thanks for video

  • @primavera919
    @primavera919 ปีที่แล้ว

    Thank you for the tutorial but do you have an "INSERT" OCD? Why do you need to press "insert" every other keyboard press?

  • @henrik3098
    @henrik3098 11 หลายเดือนก่อน

    Wow nice video man =)

  • @aminkhosravi5073
    @aminkhosravi5073 10 หลายเดือนก่อน

    Hi Wes! I was wondering how I can test CRUD operations following your procedure. Take Delete for example. How should I register mock service when the API returns NoContent Status Code? something like mockService.Setup(service=> service.DeleteUser(id)).Returns()...I don't know how to complete this piece of code after Returns for a Delete Function which is registered as a task without any return object in UserService!

  • @yavuzalter359
    @yavuzalter359 2 ปีที่แล้ว +1

    Thanks for the video.

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      Thanks for watching!

  • @prof_as
    @prof_as 3 หลายเดือนก่อน

    how you are able to type this fast ? . I noticed you are using some sort of tool that looks like vim. can you tell the name of the tool.
    by the way the video is great, easy explanation.

  • @codingbloke
    @codingbloke 2 ปีที่แล้ว +1

    Thumbs up. (Despite unnecessary use of Newtonsoft 😜).

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      :) Old habits! Thanks for watching!

  • @emredevstudio
    @emredevstudio ปีที่แล้ว

    Hey, I came across your videos, they are awesome but you really need to write longer and better titles for visibility

  • @oleksiifatichiev
    @oleksiifatichiev ปีที่แล้ว

    Great teaching and explanation of the material. However, I watched it with some difficulty because the constant keyboard clicking was quite distracting.

  • @R.Daneel
    @R.Daneel ปีที่แล้ว

    Please change the settings on your editor style preferences so we don't have to watch you move the brackets every single time you add a line of code.

  • @kevinmarkandrada
    @kevinmarkandrada 2 ปีที่แล้ว +1

    Hi Wes, would you prefer the typical Controller.cs or the new minimal api setup?

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว +1

      Hi Kevin, great question. I'd say it depends on a few factors! One consideration would be overall application architecture. The minimal API setup seems ideal for thinking small services / microservices pattern.

    • @kevinmarkandrada
      @kevinmarkandrada 2 ปีที่แล้ว +1

      @@WesDoyle Looking forward to have that in your next content. Good to see you back sir!

  • @pitthp
    @pitthp 9 หลายเดือนก่อน

    Hi there, you mentioned that we can use some factory implementation for repeating (duplicate) code. Do you have example for that?

  • @mr.nobody4494
    @mr.nobody4494 2 ปีที่แล้ว +1

    Thanks! 👌

  • @abbasfais
    @abbasfais ปีที่แล้ว

    Amazing tutorial. So much better than the stupid tutorials that show you some kind of TDD in a command line project with no follow up on how it would be applied to the real world development. Also your way of mocking the HttpClient is something I tried to find a couple of times but failed.

  • @RoamingAdhocrat
    @RoamingAdhocrat 2 ปีที่แล้ว

    1:26:00 why are we setting up a near-duplicate of `SetupBasicGetResourceList` rather than just adding an `endpoint` parameter to the original method?

  • @HuneSilver
    @HuneSilver 2 ปีที่แล้ว

    Hi Wes, what's your theme? It's great !!

  • @geovannycardozocedeno6041
    @geovannycardozocedeno6041 2 ปีที่แล้ว +1

    Muy bueno tu video saludos y suscrito

  • @ThugLifeModafocah
    @ThugLifeModafocah ปีที่แล้ว +1

    Are you using some Vim emulator for visual studio? If so, which one?

  • @DayMan85Theater
    @DayMan85Theater 2 ปีที่แล้ว +1

    I'm only recently working on wrapping my head around unit testing and TDD more specifically. I'm curious, in GetAllUsers_WhenCalled_ReturnsListOfUsers, would it be good to give the handlerMock a COPY of the expectedResponse Users list and then assert that result and expectedResponse contain the same items? By only asserting the count, you don't know for sure that the list isn't being manipulated in some other way after being returned from the HttpClient. Or is that overkill?

  • @jonwall9634
    @jonwall9634 2 ปีที่แล้ว +1

    Hi Wes, thanks for posting this video I am learning some new concepts here.
    I am coding along with the video and have ran into a problem at around 1h14m when "GetAllUsers_WhenCalled_InvokesHttpGetRequest()" and "GetAllUsersWhenCalled_ReturnsListOfUsers()" both return the same failed test message.
    The message reads: "System.ArgumentException : No protected method HttpMessageHandler.SendAsync found whose signature is compatible with the provided arguments (HttpResponseMessage, CancellationToken)."
    As far as I am aware I have copied the coding perfectly, but it is possible I have made a mistake somewhere.
    Do you know what is causing these tests to fail?
    Thanks in advance,
    Jon

  • @tony-ma
    @tony-ma 2 ปีที่แล้ว +1

    Hi @Wes, what browser and extension did you use to inspect the web API response at 1:38:17?

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว +1

      Hi Tony! I'm using Firefox Developer Edition here. Thanks for watching!

  • @anushathomas6882
    @anushathomas6882 2 ปีที่แล้ว

    Great explanation, Thank you ! Just one question any particular reason why you did not choose MS TEST project in VS instead of XUnit ? Is it a hard rule that we should use XUnit project for TDD or can we do the same with MS Test ?

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว +4

      Hi Anusha, MS Test can be used, it’s just a matter of framework preference. Each framework is a bit different! 😄

  • @leeliquid85
    @leeliquid85 2 ปีที่แล้ว +1

    Hi, this has always been a question I have on my mind. Is there any particular reason that you choose to use command line to create new solution and projects vs using Visual Studio or something has a GUI?

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      just for convenience!

    • @yt-1337
      @yt-1337 2 ปีที่แล้ว

      why would you go to vs and click through all that shit, if you can just do 3 commands

  • @danijelzg001
    @danijelzg001 2 ปีที่แล้ว

    Does the creating interface IUserService first for that InvokesUserService breaks the tdd pattern? Don't see point in creating mock of something that does not exists, you get build errors and you lose intelisense

  • @diegomelgar2696
    @diegomelgar2696 ปีที่แล้ว

    Hi @Wes, wondering if there would be a TDD video using factories, seeding data? Do you know or anyone here an excellent resource where I can find TDD with factories, mocking, seeding using .NET and that uses .NET CORE 6 or above?

  • @stomic50
    @stomic50 ปีที่แล้ว +2

    anyone else triggered by Wes moving { up with method names? :D

    • @eliasmonroy7257
      @eliasmonroy7257 4 หลายเดือนก่อน

      Ctrl + K + D
      😂😂😂

  • @ashrafmir9991
    @ashrafmir9991 ปีที่แล้ว

    Great

  • @nomadnoland
    @nomadnoland 2 ปีที่แล้ว +3

    Thanks for the tutorial, but why on earth should we spend one hour and a half to write a simple method that returns a list in a real environment? really I can't get my head around it.

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      in time it takes far less time, of course. and sometimes the answer is likely that you shouldn’t. there always tradeoffs, and everything depends on context.

  • @peculiarpeculiar2504
    @peculiarpeculiar2504 2 ปีที่แล้ว +1

    Mehn, how I missed you.

  • @ammarmangala9814
    @ammarmangala9814 2 ปีที่แล้ว

    why is there no link to the repo?

  • @RoamingAdhocrat
    @RoamingAdhocrat 2 ปีที่แล้ว

    OK, got a really weird bug here / user error - I can't get the project to build / rebuild within Visual Studio. I make an edit e.g. change `return Ok("all good");` to `return Ok(users);` . Save the file. Hit "Run" in Test Explorer and the test is still failed. Run `dotnet test` in the terminal and it actually rebuilds the project and shows the test passing.
    How do I convince VS to actually rebuild the project?

    • @RoamingAdhocrat
      @RoamingAdhocrat 2 ปีที่แล้ว

      Found it. But am more baffled as a result. I had the Solution Explorer in Folder View - which somehow stops the tests from rebuilding the projects...?

  • @Ashmaelx
    @Ashmaelx ปีที่แล้ว

    This is not pure TDD. I think you make things more difficult for people who actually want to look at net core TDD, as a 3rd or 4th language, but actually know TDD ...

  • @keychain8886
    @keychain8886 2 ปีที่แล้ว

    Hello, I've question how do you solve this error on moq "Handler did not return a response message.",
    I try using same URL Address but still got that error

    • @ghostslinger3148
      @ghostslinger3148 2 ปีที่แล้ว

      getting the same error,
      fixed it,
      double check the handlerMock 1:35:24 , he changed back to any httpRequestMessage

  • @FabioGalanteMans
    @FabioGalanteMans 2 ปีที่แล้ว

    Can you make the repository available for this project?

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      Hi Fabio, thanks for reaching out. At this time, source code is available to those supporting the channel on Patreon! You can find many other open source projects on my GitHub.

  • @sivaprakas2830
    @sivaprakas2830 7 หลายเดือนก่อน

    Why can't find NUnit tutorial

  • @lastidea4925
    @lastidea4925 2 ปีที่แล้ว

    6:33 here's a quick tip: if you write ".\SolutionName.sln" it will run Visual Studio and open your solution.

  • @newabyuser
    @newabyuser 2 ปีที่แล้ว +1

    Been a while

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว

      Yes indeed, great to hear from you!

  • @atabayilker
    @atabayilker 10 หลายเดือนก่อน

    It's an awesome content for people getting into testing, but those unnecessary amounts of key presses got me a bit too hard :D Like WHY :D 17:14 - 17:17. Way too loud for me to concentrate on the actual thing that's going on.

  • @kresnofatihimani5073
    @kresnofatihimani5073 2 ปีที่แล้ว

    this feels like integration tests instead if unit tests

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว +2

      Hi Kresno, since I'm mocking out dependencies to test the method calls in isolation, I refer to this as unit testing. I tend to call integration tests those tests which encompass a greater system (e.g. integrating a database, network, or hardware). Thanks for watching!

    • @kresnofatihimani5073
      @kresnofatihimani5073 2 ปีที่แล้ว +1

      @@WesDoyle i shouldnt have said that sorry. Im a noob. Plz disregard my comment XD just keep the videos comin bro

    • @WesDoyle
      @WesDoyle  2 ปีที่แล้ว +1

      @@kresnofatihimani5073 no problem at all! i appreciate the question! all the best

  • @yoanncatala3525
    @yoanncatala3525 2 ปีที่แล้ว +1

    Very good content. Thanks a lot for this guide.
    Just a comment as a viewer on something a bit annoying, too many code highlighting and navigation keyboard tricks, as your keystrokes are very loud. It's sometimes hard to focus on what you're saying seeing you going back and forward and highlighting every piece of code. 😉
    Nevertheless, appreciate your effort doing such good video.

  • @danielwilkowski5899
    @danielwilkowski5899 8 หลายเดือนก่อน

    13:00 - in TDD, you would remove that controller completely, and let tests drive creation of it.
    13:20 - premature creation of Helpers and Fixtures
    16:23 - explanation of why it's okay to leave the users controller "we know that's what it's going to look like". that's not tdd. that's coming up with code without tests.
    24:10 - the "all good" string is not necessary for the tests to pass.
    32:10 - you have added the service, the mock and the inject without any tests for that at all. not tdd. you should first write an assertion without ever writing the mock, see the test fail, then implement the service without mocks, and then write another test for the overriden behaviour. in TDD you should not write any code without tests (but you did), and you should not write any more test code that is necessary to make the test fail (which you again did do).
    Not watching anymore since that's clearly not TDD. it's probably a good start to testing, a good introduction to TDD, but that's not TDD.

  • @grumpydeveloper69
    @grumpydeveloper69 2 ปีที่แล้ว

    Like the explanation and the way you show this subject. But man does this become a cluttered mess and this is just a few lines of actual controller and service code. The TDD code and all it's setup and mocking takes up so moch lines and time.
    What is a reasonable size this will be when you actually have implemented this on a true production app. I get that this pays off when you modify stuff then without breaking things without you knowing but man, won't this slow down development cycles and drive up cost to triple?
    Really not trying to dis TDD I really want to use this but I have no reference with production size apps

  • @turkerkaraoglu1675
    @turkerkaraoglu1675 2 ปีที่แล้ว +2

    Its nice until 1:16:00 , then everything is getting messy. Also not using mouse, instead always using keyboard why? Its very annoying.

  • @emilbabazade70
    @emilbabazade70 2 ปีที่แล้ว

    "screen real-estate"

  • @joseperezbalan7788
    @joseperezbalan7788 ปีที่แล้ว

    am sorry for my ignorance, i am 40 min into the video and TDD just seems like a waste of time to me...

    • @bethshebaovercame5587
      @bethshebaovercame5587 ปีที่แล้ว

      Ive been in IT for 20 years but im a new developer. If you plan on getting a job as an SDE, you MUST know how to unit test. Its a MUST. Especially at large companies.
      If you are just building stuff for yourself, then its fine if you dont test your code. We CANNOT get away with no unit tests and integration tests at work.