public void GetProductsByName_ReturnsNoMatchingProducts_WhenNoProductWithTheGivenNameExists() { //Arrange var repo = new LiteDbProductRepository(TestDatabaseString); //Act var actual = repo.GetProductsByName("NO PRODUCT").ToList(); //Assert Assert.IsTrue(actual.Count == 0); }
public void GetAllProducts_ReturnsAllProducts() { //Arrange var repo = new LiteDbProductRepository(TestDatabaseString); var expected = productList.OrderBy(e => e.Id).ToList(); //Act var actual = repo.GetAllProducts().OrderBy(e => e.Id).ToList(); //Assert Assert.IsTrue(productList.IsDeepEqual(actual)); }
public void GetProductsByName_ReturnsTwoMatchingProducts_WhenOneProductWithTheGivenNameExists() { //Arrange var repo = new LiteDbProductRepository(TestDatabaseString); var expected = productList.Where(e => e.Name.Contains("Shirt")).OrderBy(e => e.Id).ToList(); //Act var actual = repo.GetProductsByName("Shirt").OrderBy(e => e.Id).ToList(); //Assert Assert.IsTrue(actual.Count == 2); Assert.IsTrue(expected.IsDeepEqual(actual)); }
public void GetProductsByName_ReturnsOneMatchingProduct_WhenOneProductWithTheGivenNameExists() { //Arrange var repo = new LiteDbProductRepository(TestDatabaseString); var expected = productList.First(e => e.Name == "Red Shirt"); //Act var actual = repo.GetProductsByName("Red Shirt").ToList(); //Assert Assert.IsTrue(actual.Count == 1); Assert.IsTrue(expected.IsDeepEqual(actual.First())); }