Example #1
0
        public void ReadProductFileValidationTest()
        {
            //-- Arrange

            DataImporterService dataImporterService = new DataImporterService();
            ProductService      productService      = new ProductService();

            Companies = dataImporterService.GetCompanies();
            Feeds     = dataImporterService.GetFeeds();
            Products  = new List <Product>();
            //return Ok();
            foreach (Company company in Companies)
            {
                foreach (Feed feed in Feeds)
                {
                    if (company.Id.ToString().Substring(0, 1) == feed.Id.ToString().Substring(0, 1))
                    {
                        //Get Product for Company Feed
                        foreach (Product product in productService.GetProducts(company, feed))
                        {
                            Products.Add(product);
                        }
                    }
                }
            }

            //-- Act
            int actual = 18000;

            //-- Assert
            Assert.AreEqual(Products.Count, actual);
        }
        public DataImporterServiceTests()
        {
            this.loggerMock            = new Mock <ILogger>();
            this.crmServiceAdapterMock = new Mock <ICrmServiceAdapter>();

            this.dataImporterService = new DataImporterService(this.loggerMock.Object, this.crmServiceAdapterMock.Object);
        }
 public ProductController(ILogger <ProductController> logger,
                          DataImporterService dataImporterService,
                          ProductService productService,
                          DataImporterContext dbContext)
 {
     _logger         = logger;
     importerService = dataImporterService;
     ProdService     = productService;
     context         = dbContext;
 }
Example #4
0
        public void ReadCompanyFileValidationTest()
        {
            //-- Arrange

            DataImporterService dataImporterService = new DataImporterService();
            ProductService      productService      = new ProductService();

            Companies = dataImporterService.GetCompanies();
            int dataCount = 0;

            foreach (Company comoany in Companies)
            {
                dataCount++;
            }

            //-- Act
            int actual = 3;

            //-- Assert
            Assert.AreEqual(dataCount, actual);
        }
Example #5
0
        public void ReadFeedFileValidationTest()
        {
            //-- Arrange

            DataImporterService dataImporterService = new DataImporterService();
            ProductService      productService      = new ProductService();

            Feeds = dataImporterService.GetFeeds();
            int dataCount = 0;

            foreach (Feed feed in Feeds)
            {
                dataCount++;
            }

            //-- Act
            int actual = 15;

            //-- Assert
            Assert.AreEqual(dataCount, actual);
        }