Ejemplo n.º 1
0
        public void FindOrdersByShippingData_Invoke_test()
        {
            //Arrange
            using (ISalesManagementService orderService = IoCFactory.Instance.CurrentContainer.Resolve <ISalesManagementService>())
            {
                DateTime initDate = new DateTime(2010, 1, 1);
                DateTime endDate  = new DateTime(2010, 5, 1);

                string shippingName    = "Windows Seven buy";
                string shippingZip     = "28081";
                string shippingCity    = "Madrid";
                string shippingAddress = "Sebastian el Cano";

                //act
                List <Order> orders = orderService.FindOrdersByShippingData(shippingName, null, null, null);

                //Assert
                Assert.IsNotNull(orders);
                Assert.IsTrue(orders.Count == 1);

                //act
                orders = orderService.FindOrdersByShippingData(null, null, null, shippingZip);

                //Assert
                Assert.IsNotNull(orders);
                Assert.IsTrue(orders.Count >= 2);

                //act
                orders = orderService.FindOrdersByShippingData(null, null, shippingCity, null);

                //Assert
                Assert.IsNotNull(orders);
                Assert.IsTrue(orders.Count >= 1);

                //act
                orders = orderService.FindOrdersByShippingData(null, shippingAddress, null, null);

                //Assert
                Assert.IsNotNull(orders);
                Assert.IsTrue(orders.Count >= 1);

                //act
                orders = orderService.FindOrdersByShippingData(shippingName, shippingAddress, shippingCity, shippingZip);

                //Assert
                Assert.IsNotNull(orders);
                Assert.IsTrue(orders.Count == 1);
            }
        }
Ejemplo n.º 2
0
        public void AddOrder_Invoke_Test()
        {
            //Arrange
            using (ISalesManagementService orderService = IoCFactory.Instance.CurrentContainer.Resolve <ISalesManagementService>())
            {
                string shippingZip = "9999";
                Order  order       = new Order()
                {
                    OrderDate       = DateTime.Now,
                    DeliveryDate    = DateTime.Now.AddDays(1),
                    ShippingAddress = "shipping address",
                    ShippingCity    = "Shipping City",
                    ShippingName    = "Shipping Name",
                    ShippingZip     = shippingZip,
                    CustomerId      = 1
                };

                //act
                orderService.AddOrder(order);
                List <Order> products = orderService.FindOrdersByShippingData(null, null, null, shippingZip);

                //assert
                Assert.IsNotNull(products);
                Assert.IsTrue(products.Count == 1);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// <see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/>
        /// </summary>
        /// <param name="shippingData"><see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/></param>
        /// <returns><see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/></returns>
        public List <Order> GetOrdersByShippingData(ShippingInformation shippingData)
        {
            //Resolve root dependencies and perform operation
            ISalesManagementService salesManagement = IoCFactory.Instance.CurrentContainer.Resolve <ISalesManagementService>();

            return(salesManagement.FindOrdersByShippingData(shippingData.ShippingName,
                                                            shippingData.ShippingAddress,
                                                            shippingData.ShippingCity,
                                                            shippingData.ShippingZip));
        }
Ejemplo n.º 4
0
        public void ChangeOrder_Invoke_Test()
        {
            //Arrange
            ISalesManagementService orderService = IoCFactory.Instance.CurrentContainer.Resolve <ISalesManagementService>();
            string shippingName    = "Book";
            string newShippingCity = "Pozuelo";
            //Act
            List <Order> orders = orderService.FindOrdersByShippingData(shippingName, null, null, null);
            Order        order  = orders.First();

            order.ShippingCity = newShippingCity;
            orderService.ChangeOrder(order);
            orders = orderService.FindOrdersByShippingData(shippingName, null, null, null);

            //Assert
            Assert.IsNotNull(orders);
            Assert.IsTrue(orders.Count > 0);
            Assert.IsTrue(orders.First().ShippingCity == newShippingCity);
        }