Example #1
0
        public async void Delete()
        {
            Mock <ILogger <ProductCostHistoryRepository> > loggerMoc = ProductCostHistoryRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = ProductCostHistoryRepositoryMoc.GetContext();
            var repository            = new ProductCostHistoryRepository(loggerMoc.Object, context);
            ProductCostHistory entity = new ProductCostHistory();

            context.Set <ProductCostHistory>().Add(entity);
            await context.SaveChangesAsync();

            await repository.Delete(entity.ProductID);

            ProductCostHistory modifiedRecord = await context.Set <ProductCostHistory>().FirstOrDefaultAsync();

            modifiedRecord.Should().BeNull();
        }