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);*/ }
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); } }
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); } }
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); } }
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); } }
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); } }
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(); }
internal static void LoadBillingList(P1Context DB) { DB.BillingInformationList = DB.BillingInformation.ToList(); }
internal static void UpdateBilling(Billing b, P1Context DB) { DB.BillingInformation.Update(b); DB.SaveChanges(); }
internal static void LoadProductsList(P1Context DB) { DB.ProductsList = DB.Products.ToList(); }
internal static void UpdateProduct(Product p, P1Context DB) { DB.Products.Update(p); DB.SaveChanges(); }
public static void AddUserAccount(UserAccount user, P1Context DB) { DB.UserAccounts.Add(user); DB.SaveChanges(); }
public ShippingController(P1Context context) { _context = context; /*DatabaseControl.SetContext(_context);*/ }
internal static void AddProduct(Product p, P1Context DB) { DB.Products.Add(p); DB.SaveChanges(); }
internal static void UpdateUserAccount(UserAccount user, P1Context DB) { DB.UserAccounts.Update(user); DB.SaveChanges(); }
internal static void RemoveProduct(Product p, P1Context DB) { DB.Products.Remove(p); DB.SaveChanges(); }
internal static void RemoveUserAccount(UserAccount user, P1Context DB) { DB.UserAccounts.Remove(user); DB.SaveChanges(); }
internal static void AddBilling(Billing b, P1Context DB) { DB.BillingInformation.Add(b); DB.SaveChanges(); }
public static void LoadUserAccountsList(P1Context DB) { DB.UserAccountsList = DB.UserAccounts.ToList(); }
internal static void RemoveBilling(Billing b, P1Context DB) { DB.BillingInformation.Remove(b); DB.SaveChanges(); }
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(); }
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(); }
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);*/ }
public static void LoadCustomersList(P1Context DB) { DB.CustomersList = DB.Customers.ToList(); }