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