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