Beispiel #1
0
        public IUserWithOrdersResult CreateUserWithOrders()
        {
            var userResult = CreateValidatedUser();

            var now    = DateTime.Now;
            var result = new UserWithOrderResult()
            {
                UserData            = userResult.UserData,
                AccountSettingsData = userResult.AccountSettingsData,
                OrderData           = new List <IOrderItem>()
                {
                    new OrderItem()
                    {
                        OrderId  = Guid.NewGuid().ToString("N"),
                        Name     = Guid.NewGuid().ToString("N"),
                        Quantity = now.Millisecond,
                        Price    = (now.Millisecond + 1) * (now.Minute + 1) / 100m
                    }
                }
            };

            var orderOrchestrator = new OrdersOrchestrations(userResult.AccountSettingsModel.Nav.Orders.Click());

            foreach (IOrderItem order in result.OrderData)
            {
                orderOrchestrator.CreateOrder(order);
            }

            result.OrdersModel = orderOrchestrator.Model;
            return(result);
        }
Beispiel #2
0
        public void AfterSavingOrder_OrderAppearsInList()
        {
            string  newOrderId  = Guid.NewGuid().ToString("N");
            string  newName     = Guid.NewGuid().ToString("N");
            int     newQuantity = rand.Next(1, 100);
            decimal newPrice    = 12.1m;

            var orders = new OrdersOrchestrations(this.ordersPageModel).CreateOrder(newOrderId, newName, newQuantity, newPrice);

            var match = orders.OrdersList
                        .FirstOrDefault(x => StringComparer.OrdinalIgnoreCase.Equals(newOrderId, x.OrderId.Value));

            Assert.IsNotNull(match);
            Assert.IsTrue(StringComparer.Ordinal.Equals(newOrderId, match.OrderId.Value));
            Assert.IsTrue(StringComparer.Ordinal.Equals(newName, match.Name.Value));
            Assert.IsTrue(newPrice == match.Price.Value);
            Assert.IsTrue(newQuantity == match.Quantity.Value);
        }