Using Josh Flanagans StructureMap Automocking overview, I'm trying my hand at it but can get the following code to return the Category object I've assigned:
[Test]
public void Service_Should_Return_Category_From_ID()
{
// Arrange
var categoryToTest = new Category()
{
ID = 1,
Name = "Department 1",
Description = "Department 1 description"
};
var mocks = new RhinoAutoMocker<CatalogueService>();
mocks.Get<ICatalogueService>().Stub(c => c.GetCategory(1)).Return(categoryToTest);
// Act
var categoryResult = mocks.ClassUnderTest.GetCategory(1);
// Assert
Assert.IsNotNull(categoryResult);
Assert.AreEqual(categoryToTest.ID, categoryResult.ID);
}
What am I doing wrong?