public void DeleteNotFound() { Mock <ILogger <RowVersionCheckRepository> > loggerMoc = RowVersionCheckRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = RowVersionCheckRepositoryMoc.GetContext(); var repository = new RowVersionCheckRepository(loggerMoc.Object, context); Func <Task> delete = async() => { await repository.Delete(default(int)); }; delete.Should().NotThrow(); }
public async void Delete() { Mock <ILogger <RowVersionCheckRepository> > loggerMoc = RowVersionCheckRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = RowVersionCheckRepositoryMoc.GetContext(); var repository = new RowVersionCheckRepository(loggerMoc.Object, context); RowVersionCheck entity = new RowVersionCheck(); context.Set <RowVersionCheck>().Add(entity); await context.SaveChangesAsync(); await repository.Delete(entity.Id); RowVersionCheck modifiedRecord = await context.Set <RowVersionCheck>().FirstOrDefaultAsync(); modifiedRecord.Should().BeNull(); }
public async void DeleteFound() { Mock <ILogger <RowVersionCheckRepository> > loggerMoc = RowVersionCheckRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = RowVersionCheckRepositoryMoc.GetContext(); var repository = new RowVersionCheckRepository(loggerMoc.Object, context); RowVersionCheck entity = new RowVersionCheck(); entity.SetProperties(default(int), "B", Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b")); context.Set <RowVersionCheck>().Add(entity); await context.SaveChangesAsync(); await repository.Delete(entity.Id); var records = await context.Set <RowVersionCheck>().ToListAsync(); records.Count.Should().Be(1); }