public async Task ProductSearch_TestStringNoHit() { var prodSearch = new StringContainsProductSearch(new MockDataContext()); var result = await prodSearch.Search("nothing"); Assert.AreEqual(0, result.Count()); }
public async Task ProductSearch_TestStringExistingProductPartial() { var prodSearch = new StringContainsProductSearch(new MockDataContext()); var result = await prodSearch.Search("proD"); Assert.AreEqual(6, result.Count()); }
public async Task ProductSearch_TestStringExistingProduct() { var prodSearch = new StringContainsProductSearch(new MockDataContext()); var result = await prodSearch.Search("proDucT 1"); Assert.AreEqual(1, result.Count()); Assert.IsTrue(result.Any(p => p.Title == "Product 1")); }
public Task <IEnumerable <Product> > SearchTest( [PexAssumeUnderTest] StringContainsProductSearch target, string query ) { Task <IEnumerable <Product> > result = target.Search(query); return(result); // TODO: add assertions to method StringContainsProductSearchTest.SearchTest(StringContainsProductSearch, String) }
public async Task SearchSuccess() { var productList = s_productTitles.Select(o => new Product { Title = o }).ToList(); var context = Substitute.For <IPartsUnlimitedContext>(); var productDbSet = productList.ToDbSet(); context.Products.Returns(productDbSet); var searcher = new StringContainsProductSearch(context); var thing = await searcher.Search("thing"); Assert.AreEqual(new string[] { "something", "something outside" }, thing.Select(o => o.Title)); }