The Musings Of A Dev
The Musings Of A Dev
  • Видео 25
  • Просмотров 42 774

Видео

The EASIEST way to Mock a HTTP request in C#
Просмотров 6 тыс.2 года назад
Mocking a Http Request Using Moq (or any other mocking framework) is more difficult than it should be. In this video, I'll show you the simplest way of mocking a Http Request. If you're curious, here's a link to stack overflow for the Moq way of handling Http Requests: stackoverflow.com/questions/56146243/how-to-mock-httpclient
Singleton, Scoped, Transient - What's the Difference?
Просмотров 2992 года назад
Hi all In this one we're going to be going dependency injection and specifically the lifetime information that are encapsulated into Singleton, Scoped and Transient. We'll go over the differences between them as well as when you would want to use each option.
C# Makes Global Exception Handling Super Easy
Просмотров 5 тыс.2 года назад
Hi guys and welcome to this video where I show you all a better way of handling your global exceptions in C# !!
In Memory Databases | Unit Testing With C# and XUnit
Просмотров 13 тыс.2 года назад
Learn how to use an in memory database to help with your repositories
Clean Your Context Using Configuration
Просмотров 622 года назад
Let's go over how to keep you database contexts clean in C# and dotnet core!
Data Driven Testing | Unit Testing With C# and XUnit
Просмотров 6272 года назад
Learn how to do Data Driven Testing with the Theory and InlineData attributes in XUnit
Object Graph Comparison And Be Equivalent To | Unit Testing
Просмотров 2342 года назад
Understand how Object Graph Comparison works to make your unit tests cleaner
Using Assertion Scopes With Fluent Assertions | Unit Testing
Просмотров 2442 года назад
Learning how to use Assertion Scopes to make your unit tests cleaner
Can You Really Test A Project Architecture With Fluent Assertions | Unit Testing
Просмотров 1952 года назад
Learning how to assert exceptions using Fluent Assertions
Asserting Exceptions With Fluent Assertions | Unit Testing
Просмотров 2812 года назад
Learning how to assert exceptions using Fluent Assertions
Numeric Types And Weird Floating Point Values With Fluent Assertions | Unit Testing
Просмотров 2152 года назад
Learning how to assert numeric types using Fluent Assertions as well as how Fluent Assertions has handled floating point inaccuracies
Testing Strings With Fluent Assertions | Unit Testing
Просмотров 4082 года назад
Learning how to assert strings using Fluent Assertions
Getting Started With Fluent Assertions | Unit Testing
Просмотров 7762 года назад
Introduction to the Fluent Assertions library.
Avoiding Parallelism in XUnit | Unit Testing | XUnit
Просмотров 1992 года назад
Short tutorial on how force test classes to run sequentially
Assert That An Exception Was Not Thrown - Recording Exceptions | Unit Testing With C# and XUnit
Просмотров 5173 года назад
Assert That An Exception Was Not Thrown - Recording Exceptions | Unit Testing With C# and XUnit
How To Use Callbacks Using The Moq Framework | Unit Testing
Просмотров 1,7 тыс.3 года назад
How To Use Callbacks Using The Moq Framework | Unit Testing
How to verify an Interface has been called | Unit Testing | XUnit | Moq
Просмотров 6693 года назад
How to verify an Interface has been called | Unit Testing | XUnit | Moq
So, How do you Mock an Interface when Unit Testing?
Просмотров 1,4 тыс.3 года назад
So, How do you Mock an Interface when Unit Testing?
How to Assert Null or Not Null | Unit Testing With C# and XUnit | #5
Просмотров 9023 года назад
How to Assert Null or Not Null | Unit Testing With C# and XUnit | #5
How to Assert Exceptions | Unit Testing With C# And XUnit | #4
Просмотров 4,4 тыс.3 года назад
How to Assert Exceptions | Unit Testing With C# And XUnit | #4
Assertions and Asserting Equality | Unit Testing With C# and XUnit | #3
Просмотров 2503 года назад
Assertions and Asserting Equality | Unit Testing With C# and XUnit | #3
Writing Our First Test - Unit Testing With C# and XUnit - #2
Просмотров 1573 года назад
Writing Our First Test - Unit Testing With C# and XUnit - #2
Creating The Projects - Unit Testing with C# and XUnit - #01
Просмотров 2023 года назад
Creating The Projects - Unit Testing with C# and XUnit - #01
Unit Testing with C# and XUnit - #0
Просмотров 3093 года назад
Unit Testing with C# and XUnit - #0

Комментарии

  • @SobhanEzzati
    @SobhanEzzati 4 месяца назад

    thanks. it was really helpful 👌

  • @dotnetdevni
    @dotnetdevni 9 месяцев назад

    i no ur voice angel six is back

  • @MUKKASAI
    @MUKKASAI 10 месяцев назад

    What was alternative to in memory database testing then?

    • @themusingsofadev3565
      @themusingsofadev3565 10 месяцев назад

      Since this video came out, Microsoft actually recommend against in memory databases for testing. Best thing to do is to mock out the repository when unit testing and use a docker image when you want to test the interaction with the database. Hope this helps

  • @Top10verse-q1l
    @Top10verse-q1l Год назад

    Best tutorials on Fluent Assertion and Unit testing on youtube . But its a request in your future videos please try to make font bigger .

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

      Thanks for the comment. I really appreciate that. Whenever I get around to the next video, I’ll make sure that I increase the font size. It’s always one of those things that slips my mind when making them 😊

  • @Hardik.Kalasua
    @Hardik.Kalasua Год назад

    Thank you. that was really helpful.

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

    HI there. THanks that's a good example. Could tell me what I do if I want to put a dummy service in the ServiceCollection of the this factory please?

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

      There’s a function on the factory called something like “RegisterTestServices”. Here you can replace the service that you don’t want and pass in your mock. Here’s also a more detailed blog on the subject and I also think that there’s some simplified examples on how to do this on the Microsoft website. If you’re still not sure after reading then I’ll try to root out the code 😊 timdeschryver.dev/blog/how-to-test-your-csharp-web-api#keep-test-cases-short-and-readable-with-extension-methods

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

    Excellent video, thank you!

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

    How can I used BeEquivalentTo to compare ActualObject.Flied=null and ExpectedObject.Filed = String.Empty and get they are equivalent?

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

      They’re not equivalent. Null and empty string are different values in C#. The best you could do is tell fluent assertions to ignore that field.

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

      @@themusingsofadev3565 I can't ignore because I want to compare other values to be equals

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

      Then I would override the equals method on your class if possible, otherwise I think you’re out of luck. You could always ignore it on that test and then write a specific test for the empty string null problem

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

      @@themusingsofadev3565 I need a generic solution for every model that I read form a csv or xlsx, you know, string null becomes string empty in a file

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

      @@themusingsofadev3565now you understand?

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

    Very nice Explanation

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

    This is good information. In-Mem is appropriate to test Repositories. Which is 90%. Custom data methods are tested in integration tests. I agree.

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

      I think it is worth noting that In-Mem is also very good for teaching or demoing code.

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

    perfect!

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

    very good explanation :) thanks

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

    I was searching how to test list with objects!

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

    So, a in-memory database will not be a problem, as long as it is just used to unit test, and not for integration test?

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

      You have to take into account that an in memory database won’t do anything more than put data there. It won’t check for relational integrity and doesn’t check database validation. So it all depends on what you’re test is doing. If you’re just using it to check simple logic then a in memory database is a nice option. If you’re writing tests that actual check the interaction with the database (integration tests, repository tests) then I would avoid in memory databases.

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

    a

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

    I think in-memory DBs are useful for testing Repositories and as you mentioned for integration with the DB we should use integrations tests, duh :D I really liked this video, but can you please also provide the source code?

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

      I never thought of providing the source code to be honest 😅 I’ll make sure I provide a link to the source code in the description for future videos and will add it to this one as soon as I can!

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

    Thank you for this video!

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

    great content sir

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

    The very first test I wrote was silly, just on a "is number square" function..... and it found a shitty implementation! It was coming back that 14 was a square number... but it was because of stupid decimal stuff that caused it to show positive. Testing is awesome!

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

    Is that a ski resort in washington state? It looks familiar , but I've never been

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

      As the desktop background you mean? I honestly have no idea, it’s just one of the default background options 😊

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

    Keep it up my friend. Good stuff!

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

    Great job!!