I have a problem writing my unit test in C# using Moq and xUnit. In my service I have the following code: var options = new TokenCredentialOptions { Authori
I know there are similar questions but somehow I am not able to figure out the situation in my case. I am getting Paramater count mismatch exception. Here is
I'm writing unit test. For testing the method below, public async Task<Guid> CreateWebJobStatus(string blobId, Guid loggedInUserId, string loggedInUserE
I have an Asp.net Core method with below definition. [HttpPost] public IActionResult Upload(IFormFile file) { if (file == null || file.Length == 0)
I started to learn a new topic for me - unit testing. Ffter writing a few tests, I began to wonder what else can be written and whether it will not be redundant
I initially used the Moq library for testing, since I don't actually want to mess the data in my database. However, I quickly realized instead of running the co
Consider a scenario when you need to write integration tests for the REST API controllers. I use MSTest for this. The logic is following: Create new database, r
Consider a scenario when you need to write integration tests for the REST API controllers. I use MSTest for this. The logic is following: Create new database, r
below is an example of production code that I am trying to unit test. I am struggling to resolve a dependency to a concrete class that is being used. public My
I am trying to write a simple test with moq. When calling the mocked method for the second time, after changing the return value from the first call, the moq fr
As per last section of the Moq Quickstart defined here, I am trying to configure the following Mock in order to pass Form values to the controller method under
I've developed a wpf-mvvm application that uses wmi to document what is built into a given Computer into a json file. I've used the mvvm model to develop the ap
I am trying to mock a sub-process for my tests. I know I can return the input to the function I am mocking as such: Mock<MockedObject> mock = new Mock<
What disadvantages have an approach of sharing context by creating private static fields? If I don't need to call Dispose? public class MyTests3 : IDisposable {
Ok, I am having a hard time trying to figure out how to setup a moq for a method that takes in an expression. There are a lot of examples out there of how to to
I have some issues trying to wrap my code to be used in unit tests. The issues is this. I have the interface IHttpHandler: public interface IHttpHandler { H