コード例 #1
0
        public async System.Threading.Tasks.Task CheckProductDataSheetAvailabilityAsync_NonExistingURL()
        {
            var options = new DbContextOptionsBuilder <ChemiCleanContext>()
                          .UseSqlServer(connectionString)
                          .Options;
            var dbContext = new ChemiCleanContext(options);

            ProductsRepository productsRepository = new ProductsRepository(dbContext);
            ProductsService    productsService    = new ProductsService(productsRepository);
            var product = productsRepository.GetProducts().FirstOrDefault();

            if (product != null)
            {
                product.Url = "None";
                productsRepository.Commit();
            }
            var NonExistingFile = await productsService.CheckProductDataSheetAvailabilityAsync(product.Id);

            Assert.False(NonExistingFile);
        }