Unit Testing in C# 2022: 5. MVC Controllers

Поделиться
HTML-код
  • Опубликовано: 2 фев 2025

Комментарии • 29

  • @turaliskenderli9230
    @turaliskenderli9230 2 года назад +6

    The best tutorial I found about unit test!! Thank you

  • @jasminemerchant3167
    @jasminemerchant3167 11 месяцев назад +1

    Your tutorial is amazing, thanks teddy

  • @al-doori2392
    @al-doori2392 Год назад

    Thank you Teddy

  • @rebinmod
    @rebinmod Год назад

    Why we use mock objects?
    It's faster . It gives us consistent results ,It helps to isolate the unit under test.

  • @shaunhunterit342
    @shaunhunterit342 Год назад +2

    Hey, thank you for the video series. Next time though could you please provide a link to the code you're working with at the time. Your repo has changed massively since you posted this video. Some changes I could work around but the detail function not even being present was an awkward one.

    • @TeddySmithDev
      @TeddySmithDev  Год назад +1

      Yeah in the future will def not change code base like I did. For anyone watching, you can go back into history and view code after different commit spots. I can imagine it helps with learning process too because you have to dig into code lol!

    • @shaunhunterit342
      @shaunhunterit342 Год назад

      @@TeddySmithDev yeah this is true, definitely had to think!

  • @akisklep
    @akisklep 9 месяцев назад +1

    I appreciate your effort into making this series.
    Although, it feels like you don't fully understand what you are doing and what you are talking. You repeated that you don't even understand how some things works - "it's just like that,". If you don't understand, then we will not understand either.. You also tend to not follow your own doing, which makes your explanations a bit tangled.
    Anyway I thank you for your time you put into this material, it wasn't that bad either but rather helpful.

  • @rebinmod
    @rebinmod Год назад

    Hi Teddy .
    fakeiteasy dose not allow faking a class.
    I want to mock a class and access a public property of it. What should I do?

  • @foudilbenouci482
    @foudilbenouci482 Год назад

    The async method returns a Task why is it a Fake instead of Fake that you create (the same thing for the IEnumerable instead of Task? thank you

  • @jthnsthm
    @jthnsthm Год назад

    I get the overall (thousand foot) concept of mocking, but then the code doesn't make sense. Example, lines 39 and 40 seems like two separate things from lines 42 and 44. (I'll keep learning...thanks!)

  • @PaulPiacitelli
    @PaulPiacitelli 2 года назад +1

    Hey Teddy. Great tutorial, but quick question. Why is it when I run my test, with the test and controller view set up the same way (view is IActionResult), I get an error stating that the test expects result to be of type ViewResult?

    • @TeddySmithDev
      @TeddySmithDev  2 года назад +1

      switch of BeOfType to ViewResult instead of IActionResult

    • @PaulPiacitelli
      @PaulPiacitelli 2 года назад

      @@TeddySmithDev that's what I did, but I didn't know why my action result page function that returns a View, set up the same as yours, would fail the test. Another test ran on an edit page that returned a list of model instead of one passed with the action result type check. Didn't seem to make sense

  • @pfj68821
    @pfj68821 Год назад

    Hi Ted, thanks for the video. I do have a question regarding faking Repositories that have dependencies as well. How would that work?

    • @TeddySmithDev
      @TeddySmithDev  Год назад

      When you fake them, the dependencies aren’t real. Basically a fake object is created and replaces when tests run.

  • @adnanyangilic6380
    @adnanyangilic6380 2 года назад +2

    Hello Teddy, we would like to see a crud in modal example written with IViewEngine, ViewEngineResult razor syntax and javascript ajax etc when you have time because there is not enough examples about it thank you for your tutorials.

    • @TeddySmithDev
      @TeddySmithDev  2 года назад +2

      Eventually I will release a Razor page tutorial but that's a long ways off

  • @marcelotau769
    @marcelotau769 Год назад

    Hello tedy very good

  • @chadgregory9037
    @chadgregory9037 2 года назад

    I might be wrong, but I feel like it's easier to understand the faking if we talk in terms of Test Driven Dev.... then it makes more sense to think about "oh, we have a fake IEnum here.... oh yeah, it's because the real functionality I need to write has to do that.

  • @anishjoshi1999
    @anishjoshi1999 Год назад

    love from nepal

  • @alibozkurt-i5r
    @alibozkurt-i5r 10 месяцев назад

    thanks

  • @chadgregory9037
    @chadgregory9037 2 года назад

    Hey Teddy from the future.... where is Bill ?

  • @VikramHuggi-y2s
    @VikramHuggi-y2s 27 дней назад

    well