public void DeleteNotFound() { Mock <ILogger <CallStatusRepository> > loggerMoc = CallStatusRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = CallStatusRepositoryMoc.GetContext(); var repository = new CallStatusRepository(loggerMoc.Object, context); Func <Task> delete = async() => { await repository.Delete(default(int)); }; delete.Should().NotThrow(); }
public async void DeleteFound() { Mock <ILogger <CallStatusRepository> > loggerMoc = CallStatusRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = CallStatusRepositoryMoc.GetContext(); var repository = new CallStatusRepository(loggerMoc.Object, context); CallStatus entity = new CallStatus(); entity.SetProperties(default(int), "B"); context.Set <CallStatus>().Add(entity); await context.SaveChangesAsync(); await repository.Delete(entity.Id); var records = await context.Set <CallStatus>().ToListAsync(); records.Count.Should().Be(1); }