public void CreateProduct_ValidProduct_NoExceptionsThrown() { //Arrange object expectedProduct = null; _documentSessionMock.Setup( m => m.Store(_product)) .Callback<object>(p => expectedProduct = p); var productRepository = new Data.Repositories.ProductRepository(_documentSessionMock.Object); //Act productRepository.CreateProduct(_product); //Assert Assert.AreEqual(_product, expectedProduct); }
public void ListProducts_NoInput_ReturnsListOfProducts() { //Arrange var productList = new List<Product> {_product}; var expectedProducts = new FakeRavenQueryable<Product>(productList.AsQueryable()); _documentSessionMock.Setup(m => m.Query<Product>()) .Returns(expectedProducts); var productRepository = new Data.Repositories.ProductRepository(_documentSessionMock.Object); //Act Product[] actualProducts = productRepository.ListProducts(); //Assert Assert.AreEqual(expectedProducts, actualProducts); }