Tagged articles
Image from Pexels

Tagged articles - Mock

Found 4 articles tagged with Mock

Mocking HttpClient in unit tests with Moq and Xunit when using IHttpClientFactory
Unit testing IHttpClientFactory by mocking HttpClient in .NET Core C#
 
0
.NET Core has done a great job by introducing interface for most of classes which makes them easy to write unit tests around them. However, there are a lot of classes that re commonly used which are not refactored in .NET Core...read more
Mocking System.IO filesystem in unit tests in ASP.NET Core
Testable filesystem operations in ASP.NET Core and C#
0
Working with file system operations like creating or deleting files and directories if quite often part of applications flow. Both .NET and .NET Core come with great out of the box classes and methods to achieve this. These classes and methods are part of System.IO name space, but unfortunately both .NET and .NET Core implementations are the same and they use static classes and method to manipulate files and directories on the host file system. ...read more
Unit testing repositories in ASP.NET Core with xUnit and Moq
Mocking UserManager RoleManager and DbContext in unit tests in .NET Core
0
Unit testing is an important part for maintaining code quality and what is the most important thing, avoiding bugs in production. This is one of the reasons why unit tests and high code coverage is desired as a part of the project and as a part of the build process since you can detect potential bugs and issues during the build process when unit tests are executed...read more
Mocking IConfiguration GetValue<T> extension methods in Unit Test
How to mock extension methods for IConfiguration in .NET Core
0
Now here is a trouble that was bugging me for some time and I guess who ever is using IConfigration injected in the constructor and using extension methods to access configuration values reached whan trying to write Unit Tests. IConfiguration interface is a great way to easily replace your configuration layer in application, but it has it's drawbacks. The way interface envorces configuration reading is by exposing GetSection method which return IConfigurationSection...read more

.NET

read more

JavaScript

read more

SQL/T-SQL

read more

Umbraco CMS

read more