public void TestShouldPersistData() { // Arrange var sut = CreateInMemoryRepository(SampleProducts.CreateProducts4()); // Act sut.PersistData(); // Assert var sut2 = CreateInMemoryRepository(); sut2.FillDataSet(); Assert.AreEqual(4, sut2.GetProducts().Count()); }
public void TestShouldGetProductsFromName() { // Arrange _productInteractor.SearchProducts("Product") .Returns(SampleProducts.CreateProducts4()); var sut = CreateProductController(); // Act var result = sut.GetProducts("Product"); // Assert var okResult = (OkObjectResult)result; var value = (List <Product>)okResult.Value; Assert.AreEqual((int)HttpStatusCode.OK, okResult.StatusCode); Assert.AreEqual(4, value.Count); Assert.AreEqual("ThirdProduct", value.Single(p => p.Id == 3).Name); }