コード例 #1
0
 public CustomersController(IBeautyStoreBL bsbl, ILogger <HomeController> logger, BeautyStoreDBContext context)
 {
     _beautyStoreBL = bsbl;
     // _mapper = mapper;
     _logger  = logger;
     _context = context;
 }
コード例 #2
0
        public void UpdateInventoryShouldUpdateInventory()
        {
            using (var context = new BeautyStoreDBContext(options))
            {
                //Arrange
                IBeautyStoreRepo repo      = new BSRepoDB(context);
                Inventory        inventory = new Inventory()
                {
                    InventoriesId = 1,
                    Quantity      = 10,
                    LocationId    = 1,
                    // ProductId = 1
                };

                //Act
                repo.ReplenishInventory(inventory);
            }

            using (var assertContext = new BeautyStoreDBContext(options))
            {
                var result = assertContext.Inventories.FirstOrDefault(c => c.InventoriesId == 1);
                Assert.NotNull(result);
                Assert.Equal(10, result.Quantity);
            }
        }
コード例 #3
0
        //  private BSRepoDB _BSRepoDB;


        public AccountController(SignInManager <IdentityUser> signinManager,
                                 BeautyStoreDBContext context, ILogger <IdentityUser> logger,
                                 UserManager <IdentityUser> _userManager, RoleManager <IdentityRole> roleManager)
        {
            _signinManager   = signinManager;
            _logger          = logger;
            userManager      = _userManager;
            this.roleManager = roleManager;
            _context         = context;
            // _BSRepoDB = bsRepoDb;
        }
コード例 #4
0
        public void GetCustomerByEmailReturnsCorrectCustomer()
        {
            using (var context = new BeautyStoreDBContext(options))
            {
                //Arrange
                IBeautyStoreRepo repo = new BSRepoDB(context);

                //Act
                var customer = repo.GetCustomerByEmail("*****@*****.**");
                Assert.Equal(1, customer.CustomerID);
            }
        }
コード例 #5
0
        public void GetCustomersShouldReturnAllCustomers()
        {
            using (var context = new BeautyStoreDBContext(options))
            {
                //Arrange
                IBeautyStoreRepo repo = new BSRepoDB(context);

                //Act
                var customers = repo.GetCustomers();
                Assert.Equal(3, customers.Count);
            }
        }
コード例 #6
0
        public void GetProductByIdReturnsCorrectProduct()
        {
            using (var context = new BeautyStoreDBContext(options))
            {
                //Arrange
                IBeautyStoreRepo repo = new BSRepoDB(context);

                //Act
                var product = repo.GetProductByID(1);
                Assert.Equal("6", product.ProductName);
            }
        }
コード例 #7
0
        public void GetProductsReturnsAllProjects()
        {
            using (var context = new BeautyStoreDBContext(options))
            {
                //Arrange
                IBeautyStoreRepo repo = new BSRepoDB(context);

                //Act
                var products = repo.GetProducts();
                Assert.Equal(3, products.Count);
            }
        }
コード例 #8
0
        public void GetLocationsReturnsAllLocations()
        {
            using (var context = new BeautyStoreDBContext(options))
            {
                //Arrange
                IBeautyStoreRepo repo = new BSRepoDB(context);

                //Act
                var locations = repo.GetLocations();
                Assert.Equal(3, locations.Count);
            }
        }
コード例 #9
0
        public void GetItemsReturnsAllItems()
        {
            using (var context = new BeautyStoreDBContext(options))
            {
                //Arrange
                IBeautyStoreRepo repo = new BSRepoDB(context);

                //Act
                var items = repo.GetItems();
                Assert.Equal(12, items.Count);
            }
        }
コード例 #10
0
        public void GetOrdersReturnsAllOrders()
        {
            using (var context = new BeautyStoreDBContext(options))
            {
                //Arrange
                IBeautyStoreRepo repo = new BSRepoDB(context);

                //Act
                var orders = repo.GetOrders();
                Assert.Equal(6, orders.Count);
            }
        }
コード例 #11
0
        public void GetOrdersByLocationReturnsCorrectOrder()
        {
            using (var context = new BeautyStoreDBContext(options))
            {
                //Arrange
                IBeautyStoreRepo repo = new BSRepoDB(context);

                //Act
                var orders = repo.GetOrdersByLocation("CA");

                Assert.NotNull(orders);
                Assert.Equal(2, orders.Count);
            }
        }
コード例 #12
0
        public void GetOrdersByCustomerReturnsCorrectOrder()
        {
            using (var context = new BeautyStoreDBContext(options))
            {
                //Arrange
                IBeautyStoreRepo repo = new BSRepoDB(context);

                //Act
                var orders = repo.GetOrdersByCustomer("Calvin");

                Assert.NotNull(orders);
                Assert.Single(orders);
            }
        }
コード例 #13
0
        public void CustomerExistsReturnsCorrectly()
        {
            using (var context = new BeautyStoreDBContext(options))
            {
                //Arrange
                IBeautyStoreRepo repo = new BSRepoDB(context);

                //Act
                bool test1 = repo.CustomerExists("*****@*****.**");
                bool test2 = repo.CustomerExists("*****@*****.**");

                Assert.True(test1);
                Assert.False(test2);
            }
        }
コード例 #14
0
        public void AddCustomerShouldAddCustomer()
        {
            using (var context = new BeautyStoreDBContext(options))
            {
                IBeautyStoreRepo repo = new BSRepoDB(context);
                repo.AddCustomer
                (
                    new Customer
                {
                    CustomerName = "Angela",
                    HomeAddress  = "123 um rd",
                    PhoneNumber  = "1236549870",
                    EmailAddress = "*****@*****.**"
                }
                );
            }

            using (var assertContext = new BeautyStoreDBContext(options))
            {
                var result = assertContext.Customers.FirstOrDefault(c => c.CustomerName.Equals("testname"));
                Assert.NotNull(result);
                Assert.Equal("testname", result.CustomerName);
            }
        }
コード例 #15
0
 public InventoriesController(BeautyStoreDBContext context)
 {
     _context = context;
 }
コード例 #16
0
 public BeautyProductsController(BeautyStoreDBContext context)
 {
     _context = context;
 }
コード例 #17
0
 public AdminPanelController(BeautyStoreDBContext context)
 {
     _context = context;
 }
コード例 #18
0
 public LocationsController(BeautyStoreDBContext context)
 {
     _context = context;
 }