Ale, music and enjoying life.
There’s scenarios where we don’t care about the Moq “It.IsAny<>” parameter value being passed into a mocked method but we need to get the value on the way out. For example, take the scenario below. I’m using SQLite to form integration tests and I…
Issue Following on from my afternoon with Moq I stumbled upon another fun issue. How the hell could I test my API’s PATCH methods? They all make use of OData’s Delta objects. Solution It’s actually fairly simple. You just need to create a new…
Issue Using Moq I was creating a few unit tests and stumbled across an interesting problem. I needed to mock a call to an async method on a service under test that took in a 2 parameters and returned a tuple of 2 values….
The Scenario I have a loop in production code that has evolved into processing batches of records. I need to modify an existing unit test to accommodate mocking the same method call each time through the loop returning different results on each loop (as…
What follows is simply a few rough notes I made with experience with a Moq framework and converting to Rhino Mocks: Asserting a method call ISomethingRepository mockedSomethingRepository = MockRepository.GenerateMock(); var person = new Person { name = “Bob” }; // Act var something =…