public async Task ItemRepository_GetItems_Success() { // Arrange SetupEnvironment(); var item = new Item() { Id = "d3ab2dfa878227b15f1a0575", Name = "Rose", Description = "Thorns", Price = 12, Quantity = 5 }; await _itemRepository.Add(item); // Act var result = await _itemRepository.GetAll(); // Assert Assert.NotEmpty(result); Assert.Single(result.ToList()); Assert.Equal(item.Id, result.First().Id); Assert.Equal(item.Name, result.First().Name); Assert.Equal(item.Id, result.First().Id); _context.DropDatabase(); }
public async Task CartRepository_GetItems_Success() { // Arrange SetupEnvironment(); var item = new Item() { Id = "d3ab2dfa878227b15f1a0575", Name = "Rose", Description = "Thorns", Price = 12, Quantity = 5 }; await _itemRepository.Add(item); var cart = new Cart() { Id = "c7f01298c560c211ebe9a73e", Items = new List <Item>() { item }, }; await _cartRepository.Add(cart); // Act var result = await _cartRepository.GetAll(); // Assert Assert.NotEmpty(result); Assert.Single(result.ToList()); Assert.Equal(cart.Id, result.First().Id); Assert.Equal(cart.Items.First().Id, result.First().Items.First().Id); _context.DropDatabase(); }