Example #1
0
        public async void CanAddCartToUser()
        {
            DbContextOptions <StoreDbContext> options = new DbContextOptionsBuilder <StoreDbContext>()
                                                        .UseInMemoryDatabase("CanAddCartToUserTest")
                                                        .Options;

            using (StoreDbContext cartContext = new StoreDbContext(options))
            {
                CartService cs = new CartService(cartContext);

                Cart addedCart = await cs.AddCartToUser("1");

                var result = await cs.GetCartByUserID("1");

                Assert.Equal("1", result.UserId);
            };
        }