public void AddDiscountAndDontReceiveItBecauseDatePassed() { //check there is no discount for ouch CheckNoDiscountAdded(); MarketAnswer res = _storeManagementBridge.AddDiscountToProduct("Ouch", Convert.ToDateTime("14/04/2018"), Convert.ToDateTime("15/04/2018"), 10, "HIDDEN", false); Assert.AreEqual((int)DiscountStatus.Success, res.Status); string coupon = res.ReportList[0]; MarketYard.SetDateTime(Convert.ToDateTime("16/04/2018")); //check the discount was added to the product in the stock MarketAnswer stock = _storeShoppingBridge.ViewStoreStock("Toy"); string[] receivedStock = stock.ReportList; string[] expectedStock = { " name: Ouch base price: 30 description: Ouchouch Discount: {type is: hidden} Purchase Way: Immediate Quantity: 6" }; Assert.AreEqual(expectedStock.Length, receivedStock.Length); for (int i = 0; i < receivedStock.Length; i++) { Assert.AreEqual(expectedStock[i], receivedStock[i]); } SignUp(ref _userBuyer, "Vika", "Arad", "5555", "55555555"); _storeShoppingBridge2 = StoreShoppingDriver.getBridge(); _storeShoppingBridge2.GetStoreShoppingService(_userBuyer.GetUserSession()); _storeShoppingBridge2.AddProductToCart("Toy", "Ouch", 3); //make sure the price in the cart is the original price MarketAnswer cartDetails = _userBuyer.ViewCart(); string[] receivedItems = cartDetails.ReportList; string[] expectedItems = { "Name : Ouch Store : Toy Quantity : 3 Unit Price : 30 Final Price : 90", }; Assert.AreEqual(expectedItems.Length, receivedItems.Length); for (int i = 0; i < receivedItems.Length; i++) { Assert.AreEqual(expectedItems[i], receivedItems[i]); } CreateOrderWithCouponInvalidCoupon(coupon); SignInAdmin("Arik1", "123"); _userAdminBridge = AdminDriver.getBridge(); _userAdminBridge.GetAdminService(_userAdmin.GetUserSession()); MarketAnswer purchaseHistory = _userAdminBridge.ViewPurchaseHistoryByUser("Vika"); //make sure the purchase didn't complete string[] purchaseReceived = purchaseHistory.ReportList; Assert.IsNull(purchaseReceived); }
public void SuccessHistoryPurchaseUser() { SignIn(adminName, adminPass); _adminBridge.GetAdminService(_adminSignInBridge.GetUserSession()); MarketAnswer res = _adminBridge.ViewPurchaseHistoryByUser(userToCheck); string[] purchaseUserHistory = res.ReportList; string[] expectedHistory = { "User: Pnina Product: Goodbye Store: blahblah2 Sale: Immediate Quantity: 2 Price: 20 Date: " + DateTime.Now.Date.ToString("dd/MM/yyyy"), "User: Pnina Product: hello Store: blahblah Sale: Immediate Quantity: 2 Price: 20 Date: " + DateTime.Now.Date.ToString("dd/MM/yyyy") }; Assert.AreEqual((int)ViewPurchaseHistoryStatus.Success, res.Status); for (int i = 0; i < purchaseUserHistory.Length; i++) { Assert.AreEqual(expectedHistory[i], purchaseUserHistory[i]); } }
public void SuccessDeleteUserNotSoleOwner() { SignIn(adminName, adminPass); _adminBridge.GetAdminService(_adminSignInBridge.GetUserSession()); Assert.AreEqual((int)RemoveUserStatus.Success, _adminBridge.RemoveUser(userNotSoleStoreOwner).Status); _signInBridge = UserDriver.getBridge(); _signInBridge.EnterSystem(); Assert.AreEqual((int)SignInStatus.NoUserFound, _signInBridge.SignIn(userNotSoleStoreOwner, userNotSoleStoreOwnerPass).Status); }
public void GetAdminService(IUserService userService) { if (real != null) { real.GetAdminService(userService); } else { throw new NotImplementedException(); } }
public void AddDiscountAndDontReceiveItBecauseDatePassed() { //check there is no discount for ouch CheckNoDiscountAdded(); MarketAnswer res = _storeManagementBridge.AddDiscountToProduct("Ouch", Convert.ToDateTime("14/04/2018"), Convert.ToDateTime("15/04/2018"), 10, "VISIBLE", false); Assert.AreEqual((int)DiscountStatus.Success, res.Status); MarketYard.SetDateTime(Convert.ToDateTime("16/04/2018")); //check the discount was added to the product in the stock MarketAnswer stock = _storeShoppingBridge.ViewStoreStock("Toy"); string[] receivedStock = stock.ReportList; string[] expectedStock = { " name: Ouch base price: 30 description: Ouchouch Discount: {DiscountAmount: 10 Start Date: " + Convert.ToDateTime("14/04/2018").Date.ToString("d") + "" + " End Date: " + Convert.ToDateTime("15/04/2018").Date.ToString("d") + " type is: visible} Purchase Way: Immediate Quantity: 6" }; Assert.AreEqual(expectedStock.Length, receivedStock.Length); for (int i = 0; i < receivedStock.Length; i++) { Assert.AreEqual(expectedStock[i], receivedStock[i]); } SignUp(ref _userBuyer, "Vika", "Arad", "5555", "55555555"); _storeShoppingBridge2 = StoreShoppingDriver.getBridge(); _storeShoppingBridge2.GetStoreShoppingService(_userBuyer.GetUserSession()); _storeShoppingBridge2.AddProductToCart("Toy", "Ouch", 3); CreateOrder(); SignInAdmin("Arik1", "123"); _userAdminBridge = AdminDriver.getBridge(); _userAdminBridge.GetAdminService(_userAdmin.GetUserSession()); MarketAnswer purchaseHistory = _userAdminBridge.ViewPurchaseHistoryByUser("Vika"); //make sure the price presented is without the discount string[] purchaseReceived = purchaseHistory.ReportList; string[] purchaseExpected = { "User: Vika Product: Ouch Store: Toy Sale: Immediate Quantity: 3 Price: 90 Date: " + DateTime.Now.Date.ToString("dd/MM/yyyy"), }; Assert.AreEqual(purchaseExpected.Length, purchaseReceived.Length); for (int i = 0; i < purchaseReceived.Length; i++) { Assert.AreEqual(purchaseExpected[i], purchaseReceived[i]); } }
public void MarketBuilder() { MarketDB.Instance.InsertByForce(); SignUp("Pnina", "mishol", "666", "66666666"); OpenStoreAndAddProducts(); _orderBridge = OrderDriver.getBridge(); _userAdminBridge = UserDriver.getBridge(); _userAdminBridge.EnterSystem(); MarketAnswer res = _userAdminBridge.SignIn("Arik1", "123"); _adminBridge = AdminDriver.getBridge(); _adminBridge.GetAdminService(_userAdminBridge.GetUserSession()); _buyerRegisteredUserBridge = null; _buyerGuestBridge = null; PaymentService.Instance.FixExternal(); SupplyService.Instance.FixExternal(); }
public void MarketBuilder() { MarketYard.SetDateTime(Convert.ToDateTime("14/04/2018")); MarketDB.Instance.InsertByForce(); SignUpStoreOwner("Pnina", "mishol", "666", "66666666"); OpenStoreAndAddProducts(); _userAdminBridge = UserDriver.getBridge(); _userAdminBridge.EnterSystem(); _userAdminBridge.SignIn("Arik1", "123"); _adminBridge = AdminDriver.getBridge(); _adminBridge.GetAdminService(_userAdminBridge.GetUserSession()); _buyerRegisteredUserBridge1 = null; _buyerRegisteredUserBridge2 = null; _buyerRegisteredUserBridge3 = null; _orderBridge1 = null; _orderBridge2 = null; _orderBridge3 = null; _buyerGuestBridge = null; PaymentService.Instance.FixExternal(); SupplyService.Instance.FixExternal(); }
private void SignInAdminSystem() { SignInAdmin("Arik1", "123"); _userAdminBridge = AdminDriver.getBridge(); _userAdminBridge.GetAdminService(_userAdmin.GetUserSession()); }