I have this code in my app .NET application using NServiceBus:
Bus.Send<IServiceStarted>(e =>
{
e.ServiceInfo = ReadServiceInfo();
e.EventTime = DateProvider.Now;
});
How would you go about unit-testing such a...
Folks
How to Exposte RhinoMock Objects as properties
I am trying following code snippet
internal class Mocks
{
private MockRepository.GenerateMock<IFormsAuthentication> formsAuthentication;
}
but its now working for me anyone know How to do this with rhinomocks
...
I'm fairly new to rhino Mocks, just started using it this project.
I am testing some code which calls an external method to get an IEnumerable of 'Project', which I've got an interface for it so that I can stub/mock it out.
at the start of my unit test that tests some of the code that iterates over (or calls Count(), both cause the e...
Sometimes I stub dependencies in test class setup and then want to restub some of them in concrete test. But Rhino mocks remembers only the first stub value and it is a bit inconvenient.
someStub.Stub(x => x.SomeMethod(1)).Return(100);
var value1 = someStub.SomeMethod(1);
someStub.Stub(x => x.SomeMethod(1)).Return(200);
var value2 = som...
I've been working on the best way to test an abstract class named TabsActionFilter. I've guranteed that classes that inherit from TabsActionFilter will have a method called GetCustomer. In practice this design seems to work well.
Where I've had some issues is figuring out how to test the OnActionExecuted method of the base class. This m...
I have extended objects of type IDataReader with some extension methods that I needed. The problem is now when I try to mock the IDataReader, the extended method is not included in the mock so when the row Expect.Call(reader.ExtensionMethod()).Return(someValue) is reach the ExtensionMethod is executed which is not what I want! I want tha...
I am trying to write a test that covers my error handling in a particular class. This class is listening for an Error event with the following signature:
OnError(int ErrorNumber, string ErrorText, ref bool retry)
The problem is with the ref bool variable at the end. I am using Rhino Mocks to create a mock interface for testing and w...
I am doing ordered expectations in rhino mocks as described by ayende in this post. My code looks something like this:
using (_mocks.Ordered())
{
Expect.Call(() => _myMock.CallA());
Expect.Call(() => _myMock.CallB(40));
Expect.Call(() => _myMock.CallA());
}
_mocks.ReplayAll();
_myObjectUnderTest.DoStuff();
_mocks.V...
Hi,
Im trying to test this statement
IStudentAssessmentUnitStatus res = student.UnitStatusList.OfType<IStudentAssessmentUnitStatus>().
FirstOrDefault(s => s.ID == unit.ID);
Inside the list there could be multiple types hence the OfType. However when testi...
So this is something I guess many people want to do, mock a collection. In the past with Rhino I have done this with something like:
var col_mock = MockRepository.GenerateMock<ICustomCollection>(); // returns ICustom let's say
List<ICustom> col_real = new List<ICustom>();
col_real.Add(custom_mock1);
col_real.Add(custom_mock2);
col_real...