public async void Delete() { Mock <ILogger <ProductPhotoRepository> > loggerMoc = ProductPhotoRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = ProductPhotoRepositoryMoc.GetContext(); var repository = new ProductPhotoRepository(loggerMoc.Object, context); ProductPhoto entity = new ProductPhoto(); context.Set <ProductPhoto>().Add(entity); await context.SaveChangesAsync(); await repository.Delete(entity.ProductPhotoID); ProductPhoto modifiedRecord = await context.Set <ProductPhoto>().FirstOrDefaultAsync(); modifiedRecord.Should().BeNull(); }