예제 #1
0
        public void GetShippingReturns_CorrectAddress()
        {
            using (var _context = new P1Context())
            {
                int    num    = 8301;
                string street = "Melrose St";
                string city   = "Houston";
                string state  = "TX";
                string zip    = "77022";

                Shipping address = DatabaseControl.GetAddress(1, _context);

                int    numA    = address.AddressNum;
                string streetA = address.AddressStreet;
                string cityA   = address.AddressCity;
                string stateA  = address.AddressState;
                string zipA    = address.AddressZipCode;

                Assert.Equal(num, numA);
                Assert.Equal(street, streetA);
                Assert.Equal(city, cityA);
                Assert.Equal(state, stateA);
                Assert.Equal(zip, zipA);
            }
        }
 public LoginController(P1Context context)
 {
     _context  = context;
     _account  = new UserAccount();
     _customer = new Customer();
     /*DatabaseControl.SetContext(_context);*/
 }
예제 #3
0
 public void GetLocationReturns_CorrectLocation()
 {
     using (var _context = new P1Context())
     {
         string   storeName = "Wavey Davey's";
         Location store     = DatabaseControl.GetLocation(3, _context);
         string   name      = store.Name;
         Assert.Equal(storeName, name);
     }
 }
예제 #4
0
 public void GetCardReturns_CorrectCard()
 {
     using (var _context = new P1Context())
     {
         string  CardNumber = "4634653646346466";
         Billing card       = DatabaseControl.GetCard(1, _context);
         string  cardNum    = card.CardNumber;
         Assert.Equal(cardNum, CardNumber);
     }
 }
예제 #5
0
 public void UserAccountExists_ReturnsFalse()
 {
     using (var _context = new P1Context())
     {
         /*DatabaseControl.SetContext(context);*/
         UserAccount account = new UserAccount
         {
             Username = "******",
             Password = "******"
         };
         bool exists = DatabaseControl.AccountExists(account, _context);
         Assert.False(exists);
     }
 }
예제 #6
0
        public void CustomerExists_ReturnsFalse()
        {
            using (var _context = new P1Context())
            {
                /*DatabaseControl.SetContext(context);*/
                Customer customer = new Customer
                {
                    FirstName = "Thomas",
                    LastName  = "Brown"
                };
                bool exists = DatabaseControl.CustomerExists(customer, _context);

                Assert.False(exists);
            }
        }
예제 #7
0
        public void CustomerExists_ReturnsTrue()
        {
            using (var _context = new P1Context())
            {
                /*DatabaseControl.SetContext(context);*/
                Customer customer = new Customer
                {
                    FirstName = "Kevin",
                    LastName  = "Mora"
                };
                bool exists = DatabaseControl.CustomerExists(customer, _context);

                Assert.True(exists);
            }
        }
예제 #8
0
        public RegisterController(IMemoryCache cache, P1Context context)
        {
            _context  = context;
            _account  = new UserAccount();
            _customer = new Customer();
            _cache    = cache;
            /*DatabaseControl.SetContext(_context);*/

            if (!_cache.TryGetValue("account", out _account))
            {
                _cache.Set("account", new UserAccount());
            }
            if (!_cache.TryGetValue("customer", out _customer))
            {
                _cache.Set("customer", new Customer());
            }
        }
 internal static void LoadDefaultLocationsList(P1Context DB)
 {
     DB.DefaultLocationList = DB.DefaultLocations.ToList();
 }
 internal static void UpdateDefaultLocation(DefaultLocation dl, P1Context DB)
 {
     DB.DefaultLocations.Update(dl);
     DB.SaveChanges();
 }
예제 #11
0
 internal static void LoadBillingList(P1Context DB)
 {
     DB.BillingInformationList = DB.BillingInformation.ToList();
 }
예제 #12
0
 internal static void UpdateBilling(Billing b, P1Context DB)
 {
     DB.BillingInformation.Update(b);
     DB.SaveChanges();
 }
예제 #13
0
 internal static void LoadProductsList(P1Context DB)
 {
     DB.ProductsList = DB.Products.ToList();
 }
예제 #14
0
 internal static void UpdateProduct(Product p, P1Context DB)
 {
     DB.Products.Update(p);
     DB.SaveChanges();
 }
예제 #15
0
 public static void AddUserAccount(UserAccount user, P1Context DB)
 {
     DB.UserAccounts.Add(user);
     DB.SaveChanges();
 }
예제 #16
0
 public ShippingController(P1Context context)
 {
     _context = context;
     /*DatabaseControl.SetContext(_context);*/
 }
예제 #17
0
 internal static void AddProduct(Product p, P1Context DB)
 {
     DB.Products.Add(p);
     DB.SaveChanges();
 }
예제 #18
0
 internal static void UpdateUserAccount(UserAccount user, P1Context DB)
 {
     DB.UserAccounts.Update(user);
     DB.SaveChanges();
 }
예제 #19
0
 internal static void RemoveProduct(Product p, P1Context DB)
 {
     DB.Products.Remove(p);
     DB.SaveChanges();
 }
예제 #20
0
 internal static void RemoveUserAccount(UserAccount user, P1Context DB)
 {
     DB.UserAccounts.Remove(user);
     DB.SaveChanges();
 }
예제 #21
0
 internal static void AddBilling(Billing b, P1Context DB)
 {
     DB.BillingInformation.Add(b);
     DB.SaveChanges();
 }
예제 #22
0
 public static void LoadUserAccountsList(P1Context DB)
 {
     DB.UserAccountsList = DB.UserAccounts.ToList();
 }
예제 #23
0
 internal static void RemoveBilling(Billing b, P1Context DB)
 {
     DB.BillingInformation.Remove(b);
     DB.SaveChanges();
 }
예제 #24
0
 public static void AddCustomer(Customer c, P1Context DB)
 {
     DB.Customers.Add(c);
     DB.SaveChanges();
 }
 internal static void AddDefaultLocation(DefaultLocation dl, P1Context DB)
 {
     DB.DefaultLocations.Add(dl);
     DB.SaveChanges();
 }
예제 #26
0
 internal static void UpdateCustomer(Customer c, P1Context DB)
 {
     DB.Customers.Update(c);
     DB.SaveChanges();
 }
 internal static void RemoveDefaultLocation(DefaultLocation dl, P1Context DB)
 {
     DB.DefaultLocations.Remove(dl);
     DB.SaveChanges();
 }
예제 #28
0
 internal static void RemoveCustomer(Customer c, P1Context DB)
 {
     DB.Customers.Remove(c);
     DB.SaveChanges();
 }
 public HomeController(ILogger <HomeController> logger, P1Context context)
 {
     _logger = logger;
     /*DatabaseControl.SetContext(context);*/
 }
예제 #30
0
 public static void LoadCustomersList(P1Context DB)
 {
     DB.CustomersList = DB.Customers.ToList();
 }