public async void Delete() { Mock <ILogger <RateRepository> > loggerMoc = RateRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = RateRepositoryMoc.GetContext(); var repository = new RateRepository(loggerMoc.Object, context); Rate entity = new Rate(); context.Set <Rate>().Add(entity); await context.SaveChangesAsync(); await repository.Delete(entity.Id); Rate modifiedRecord = await context.Set <Rate>().FirstOrDefaultAsync(); modifiedRecord.Should().BeNull(); }
public async void Update_Entity_Is_Not_Tracked() { Mock <ILogger <RateRepository> > loggerMoc = RateRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = RateRepositoryMoc.GetContext(); var repository = new RateRepository(loggerMoc.Object, context); Rate entity = new Rate(); context.Set <Rate>().Add(entity); await context.SaveChangesAsync(); await repository.Update(new Rate()); var modifiedRecord = context.Set <Rate>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }