public async void Get() { Mock <ILogger <EmailAddressRepository> > loggerMoc = EmailAddressRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = EmailAddressRepositoryMoc.GetContext(); var repository = new EmailAddressRepository(loggerMoc.Object, context); EmailAddress entity = new EmailAddress(); context.Set <EmailAddress>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.BusinessEntityID); record.Should().NotBeNull(); }
public async void Update_Entity_Is_Tracked() { Mock <ILogger <EmailAddressRepository> > loggerMoc = EmailAddressRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = EmailAddressRepositoryMoc.GetContext(); var repository = new EmailAddressRepository(loggerMoc.Object, context); EmailAddress entity = new EmailAddress(); context.Set <EmailAddress>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.BusinessEntityID); await repository.Update(record); var modifiedRecord = context.Set <EmailAddress>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }