Пример #1
0
 public void TestMethod1()
 {
     ProductDataConsolidator instance = new ProductDataConsolidator();
     var plist  = instance.Get(State.NZ);
     var plist2 = instance.Get(State.US);
     var plist3 = instance.Get(State.EURO);
 }
Пример #2
0
 public static void Main(string[] args)
 {
     Console.WriteLine("NZD ===============================================");
     foreach (var product in ProductDataConsolidator.Get())
     {
         Console.WriteLine(product.Name);
         Console.WriteLine(product.Type);
         Console.WriteLine(product.Price);
     }
     Console.WriteLine("===============================================");
     Console.WriteLine("USD ===============================================");
     foreach (var product in ProductDataConsolidator.GetInUSDollars())
     {
         Console.WriteLine(product.Name);
         Console.WriteLine(product.Type);
         Console.WriteLine(product.Price);
     }
     Console.WriteLine("===============================================");
     Console.WriteLine("EUR ===============================================");
     foreach (var product in ProductDataConsolidator.GetInEuros())
     {
         Console.WriteLine(product.Name);
         Console.WriteLine(product.Type);
         Console.WriteLine(product.Price);
     }
     Console.WriteLine("===============================================");
 }
Пример #3
0
        public void GetProducts_Search_null()
        {
            SearchCriteria searchCriteria = null;

            var productConsolidator = new ProductDataConsolidator();

            Assert.ThrowsException <ArgumentNullException>(() => productConsolidator.Get(searchCriteria));
        }
Пример #4
0
        public void GetProducts_Search_LawnMower_and_name()
        {
            SearchCriteria searchCriteria = new SearchCriteria {
                productType = ProductType.Lawnmover,
                name        = "Fisher"
            };

            var productConsolidator = new ProductDataConsolidator();
            var result = productConsolidator.Get(searchCriteria);

            Assert.IsNotNull(result);
        }
Пример #5
0
        public void GetProducts_Search_name_and_producttype_null()
        {
            SearchCriteria searchCriteria = new SearchCriteria
            {
                productType = null,
                name        = "Fisher"
            };

            var productConsolidator = new ProductDataConsolidator();
            var result = productConsolidator.Get(searchCriteria);

            Assert.IsNotNull(result);
        }
        public void GetAllProducts()
        {
            var productDataBuilderMock = new Mock<IProductDataBuilder>();
            var data = PopulateData();
            productDataBuilderMock.Setup(x => x.GetProductList())
                .Returns(data);

            var consolidator = new ProductDataConsolidator(productDataBuilderMock.Object);

            var allProducts = consolidator.Get();
            Assert.AreEqual(3, allProducts.Count);
            productDataBuilderMock.Verify(x => x.GetProductList(), Times.Once);
            CheckAsserts(allProducts, data);
        }
Пример #7
0
        public void GetAllProducts()
        {
            var productDataBuilderMock = new Mock <IProductDataBuilder>();
            var data = PopulateData();

            productDataBuilderMock.Setup(x => x.GetProductList())
            .Returns(data);

            var consolidator = new ProductDataConsolidator(productDataBuilderMock.Object);

            var allProducts = consolidator.Get();

            Assert.AreEqual(3, allProducts.Count);
            productDataBuilderMock.Verify(x => x.GetProductList(), Times.Once);
            CheckAsserts(allProducts, data);
        }