示例#1
0
        /// <summary>
        /// <see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/>
        /// </summary>
        /// <param name="publisherInformation"><see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/></param>
        /// <returns><see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/></returns>
        public List <Product> GetProductByPublisherInformation(PublisherInformation publisherInformation)
        {
            //Resolve root dependencies and perform query
            ISalesManagementService salesManagement = IoCFactory.Instance.CurrentContainer.Resolve <ISalesManagementService>();

            return(salesManagement.FindProductBySpecification(publisherInformation.PublisherName,
                                                              publisherInformation.Description));
        }
示例#2
0
        public void ChangeProduct_Invoke_Test()
        {
            //Arrange
            ISalesManagementService productService = IoCFactory.Instance.CurrentContainer.Resolve <ISalesManagementService>();
            string publisherName = "Krasis Press";
            //Act
            List <Product> products = productService.FindProductBySpecification(publisherName, null);
            Product        product  = products.FirstOrDefault();

            product.UnitAmount = "$";

            productService.ChangeProduct(product);
            products = productService.FindProductBySpecification(publisherName, null);
            product  = products.FirstOrDefault();

            //Assert
            Assert.IsNotNull(product);
            Assert.IsTrue(product.UnitAmount == "$");
        }
示例#3
0
        public void FindProductBySpecification_Invoke_Test()
        {
            //Arrange
            using (ISalesManagementService productService = IoCFactory.Instance.CurrentContainer.Resolve <ISalesManagementService>())
            {
                string publisherName = "Krasis Press";
                string description   = "Windows";

                //Act
                List <Product> products = productService.FindProductBySpecification(publisherName, null);

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

                //Act
                products = productService.FindProductBySpecification(null, description);

                //Assert
                Assert.IsNotNull(products);
                Assert.IsTrue(products.Count == 1);
            }
        }
示例#4
0
        public void AddProduct_Invoke_Test()
        {
            //Arrange
            ISalesManagementService productService = IoCFactory.Instance.CurrentContainer.Resolve <ISalesManagementService>();
            Product product = new Product()
            {
                AmountInStock      = 10,
                ProductDescription = "product description",
                Publisher          = "Microsoft Samples",
                UnitAmount         = "€",
                UnitPrice          = 100M
            };

            //Act
            productService.AddProduct(product);
            List <Product> products = productService.FindProductBySpecification("Microsoft Samples", null);

            //Assert
            Assert.IsNotNull(products);
            Assert.IsTrue(products.Count == 1);
        }