1/7/2023 0 Comments Winmerge apiAnother thing is that after you create HttpClient instance with CreateClient method, you still can’t be sure if the app is fully initialized and ready to operate. Additionally, there’s a bug in the WebApplicationFactory implementation and by default hosted services are not stopped while calling Dispose - this might result in unexpected behaviors if your app is using them. It doesn’t allow for mocking components used by our application - I guess you don’t want to run tests against the real infrastructure, at least not when it happens in local development environment. Var httpClient = applicationFactory.CreateClient() Thanks to package, setting up our WebApi application in tests is super easy: using var applicationFactory = new WebApplicationFactory() In comparison to the classical approach, this method should save you a lot of time and improve assertions maintainability. In this blog post, I’m going to share my experience on testing ASP.NET Core applications by applying an unconventional method called snapshot assertions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |