public void DeleteNotFound() { Mock <ILogger <CustomerCommunicationRepository> > loggerMoc = CustomerCommunicationRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = CustomerCommunicationRepositoryMoc.GetContext(); var repository = new CustomerCommunicationRepository(loggerMoc.Object, context); Func <Task> delete = async() => { await repository.Delete(default(int)); }; delete.Should().NotThrow(); }
public async void DeleteFound() { Mock <ILogger <CustomerCommunicationRepository> > loggerMoc = CustomerCommunicationRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = CustomerCommunicationRepositoryMoc.GetContext(); var repository = new CustomerCommunicationRepository(loggerMoc.Object, context); CustomerCommunication entity = new CustomerCommunication(); entity.SetProperties(default(int), 1, DateTime.Parse("1/1/1988 12:00:00 AM"), 1, "B"); context.Set <CustomerCommunication>().Add(entity); await context.SaveChangesAsync(); await repository.Delete(entity.Id); var records = await context.Set <CustomerCommunication>().ToListAsync(); records.Count.Should().Be(1); }