public async void Get() { Mock <ILogger <BadgeRepository> > loggerMoc = BadgeRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = BadgeRepositoryMoc.GetContext(); var repository = new BadgeRepository(loggerMoc.Object, context); Badge entity = new Badge(); context.Set <Badge>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.Id); record.Should().NotBeNull(); }
public async void Get() { Mock <ILogger <BadgeRepository> > loggerMoc = BadgeRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = BadgeRepositoryMoc.GetContext(); var repository = new BadgeRepository(loggerMoc.Object, context); Badge entity = new Badge(); entity.SetProperties(default(int), DateTime.Parse("1/1/1988 12:00:00 AM"), "B", 1); context.Set <Badge>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.Id); record.Should().NotBeNull(); }
public async void Update_Entity_Is_Tracked() { Mock <ILogger <BadgeRepository> > loggerMoc = BadgeRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = BadgeRepositoryMoc.GetContext(); var repository = new BadgeRepository(loggerMoc.Object, context); Badge entity = new Badge(); context.Set <Badge>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.Id); await repository.Update(record); var modifiedRecord = context.Set <Badge>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }