Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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);
        }