7 Tips To Deal With Large Scale Code Refactoring

image of jigsaw pieces

A few weeks back I noticed that a part of the code that I’d been working on for over a year seemed to be growing in size and needed to be addressed in order to avoid future headaches and pain. The code is by…

Mock a return type of Task and Tuple with Moq

moq logo

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….

Moq – Mocking the same method call with multiple results

moq logo

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…

Moq Vs Rhino Mocks

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 =…