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