public void TestGetDefaultRoutesForUser() { //Arrange IRouteService routeServiceMock = MockRepository.GenerateMock <IRouteService>(); routeServiceMock.Expect(x => x.GetDefaultRoutesForUser("TestUser")).Return(_returnRoutes); var mapperUnderTest = new DodgingBranchesMVC5.Mappers.RouteMapper(routeServiceMock); System.Security.Principal.IPrincipal pricipalMock = MockRepository.GenerateMock <System.Security.Principal.IPrincipal>(); pricipalMock.Expect(x => x.Identity.Name).Return("TestUser"); //Act var returnedFromText = mapperUnderTest.MapDomainToModel(pricipalMock); //Assert Assert.AreEqual(2, returnedFromText.Routes.Count); Assert.AreEqual("1 Test Street", returnedFromText.Routes[0].StartLocation.AddressLine1); Assert.AreEqual("2 Test Street", returnedFromText.Routes[1].StartLocation.AddressLine1); Assert.AreEqual(2, returnedFromText.Routes[0].Tags.Count); Assert.AreEqual(2, returnedFromText.Routes[1].Tags.Count); }