コード例 #1
0
        public void CheckForUserCreated()
        {
            IUserService usersService = new UserService(usersRepoMock.Object);
            IKartService kartsService = new KartService(kartsMock.Object, usersService, productsServiceMock.Object);

            Kart kart = new Kart();

            kartsService.Create(kart);
            Assert.True(userList.Count == 1);
            Assert.True(kart.User == userList.LastOrDefault());
        }
コード例 #2
0
        public void CheckValidAddedProductsAddedToKart(int id, int quant)
        {
            IKartService kartsService = new KartService(kartsMock.Object, usersServiceMock.Object, productsServiceMock.Object);

            Product product = new Product
            {
                Id       = id,
                Quantity = quant
            };

            productList.Add(product);
            kartsService.AddProduct(id, 5);
        }
コード例 #3
0
        public void CheckInvalidAddedProductsAddedToKart(int id, int quant)
        {
            IKartService kartsService = new KartService(kartsMock.Object, usersServiceMock.Object, productsServiceMock.Object);

            Product product = new Product
            {
                Id       = id,
                Quantity = quant
            };

            productList.Add(product);
            try
            {
                kartsService.AddProduct(id, 5);
                Assert.True(false);
            }
            catch (ArgumentException) { }
        }