Esempio n. 1
0
        public void Deny_PutNewOrder()
        {
            bool result = OrderDirectory.TryPutOrder(new Order()
            {
                Product = "thomething", Author = UserProfile1
            });

            var orderCount = OrderDirectory.GetAllOrders().Count;

            Assert.IsTrue(result == false);
            Assert.IsTrue(orderCount == 0);
        }
Esempio n. 2
0
        public void PutOrderStatus_trackingOption(bool trackingOption)
        {
            string originalStatus = OrderStatus.INITIALIZE;
            string newStatus      = OrderStatus.ACTIVE;

            OrderDirectory.TryAddOrder(new Order()
            {
                Status = originalStatus, Product = "prod", Author = UserProfile1
            });

            var firstOrder = OrderDirectory.GetAllOrders(trackingOption).Single();

            firstOrder.Status = newStatus;
            bool result = OrderDirectory.TryPutOrder(firstOrder);

            firstOrder = OrderDirectory.GetAllOrders(trackingOption).Single();
            Assert.IsTrue(result == true &&
                          firstOrder.Status == newStatus);
        }
Esempio n. 3
0
        public void PutOrderProduct_trackingOption(bool trackingOption)
        {
            string originalProduct = "first";
            string newProduct      = "newProd";

            OrderDirectory.TryAddOrder(new Order()
            {
                Product = originalProduct, Author = UserProfile1
            });


            var firstOrder = OrderDirectory.GetAllOrders(trackingOption).Single();

            firstOrder.Product = newProduct;
            bool result = OrderDirectory.TryPutOrder(firstOrder);

            firstOrder = OrderDirectory.GetAllOrders(trackingOption).Single();
            Assert.IsTrue(result == true &&
                          firstOrder.Product == newProduct);
        }
Esempio n. 4
0
        //Directory don't have any mechanism to protect order.id from changing manyally.
        //TODO fix them
        //[Test]
        public void DenyChangeOrderIdTest()
        {
            bool trackingOption = true;

            OrderDirectory.TryAddOrder(new Order()
            {
                Product = "first", Author = UserProfile1
            });
            OrderDirectory.TryAddOrder(new Order()
            {
                Product = "second", Author = UserProfile1
            });
            string newProduct = "third";

            var firstOrder = OrderDirectory.GetAllOrders(trackingOption)[0];

            firstOrder.Id++;
            firstOrder.Product = newProduct;
            bool result = OrderDirectory.TryPutOrder(firstOrder);

            firstOrder = OrderDirectory.GetAllOrders(trackingOption)[0];
            Assert.IsTrue(result == false);
            Assert.IsTrue(firstOrder.Product != newProduct);
        }