public async void CreateNewOrder_ShouldCreateNewOrder(string user, string address) { var ordersAtStart = await _orderProcessor.GetAllOrders(); int nbrOfOrdersAtStart = ordersAtStart.Count; await _orderProcessor.CreateNewOrder(user, address); var ordersAtEnd = await _orderProcessor.GetAllOrders(); int nbrOfOrdersAtEnd = ordersAtEnd.Count; Assert.True(nbrOfOrdersAtEnd > nbrOfOrdersAtStart); }
public ActionResult PlaceOrcer() { if (IsActiveSession()) { int userId = (int)Session["userId"]; var data = UserProcessor.GetUser(userId); UserModel userModel = new UserModel { Id = data.Id, FirstName = data.FirstName, LastName = data.LastName, CompanyName = data.CompanyName, TaxId = data.TaxId, TobaccoLicense = data.TobaccoLicense, EmailAddress = data.EmailAddress, Address1 = data.Address1, Address2 = data.Address2, City = data.City, State = data.State, Zip = data.Zip }; int orderNumber = OrderProcessor.CreateNewOrder(userModel.Id, userModel.FirstName + " " + userModel.LastName, userModel.CompanyName, userModel.Address1, userModel.City, userModel.State, userModel.Zip, DateTime.Now); //setting store products StoreViewModel storeViewModel = new StoreViewModel { StoreProducts = null, CartProducts = new List <CartProductsModel>() }; ViewBag.Total = 0; ViewBag.OrderNumber = "ORD000-" + orderNumber; ViewBag.OrderId = orderNumber; return(View("Confirmation", storeViewModel)); } return(RedirectToAction("Login", "Login", null)); }