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