public async void Create() { Mock <ILogger <PostTypeRepository> > loggerMoc = PostTypeRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = PostTypeRepositoryMoc.GetContext(); var repository = new PostTypeRepository(loggerMoc.Object, context); var entity = new PostType(); await repository.Create(entity); var record = await context.Set <PostType>().FirstOrDefaultAsync(); record.Should().NotBeNull(); }
public async void Create() { Mock <ILogger <PostTypeRepository> > loggerMoc = PostTypeRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = PostTypeRepositoryMoc.GetContext(); var repository = new PostTypeRepository(loggerMoc.Object, context); var entity = new PostType(); entity.SetProperties(default(int), "B"); await repository.Create(entity); var records = await context.Set <PostType>().ToListAsync(); records.Count.Should().Be(2); }