Exemplo n.º 1
0
        public async void Create()
        {
            Mock <ILogger <VoteTypeRepository> > loggerMoc = VoteTypeRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = VoteTypeRepositoryMoc.GetContext();
            var repository = new VoteTypeRepository(loggerMoc.Object, context);

            var entity = new VoteType();
            await repository.Create(entity);

            var record = await context.Set <VoteType>().FirstOrDefaultAsync();

            record.Should().NotBeNull();
        }
Exemplo n.º 2
0
        public async void Create()
        {
            Mock <ILogger <VoteTypeRepository> > loggerMoc = VoteTypeRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = VoteTypeRepositoryMoc.GetContext();
            var repository = new VoteTypeRepository(loggerMoc.Object, context);

            var entity = new VoteType();

            entity.SetProperties(default(int), "B");
            await repository.Create(entity);

            var records = await context.Set <VoteType>().ToListAsync();

            records.Count.Should().Be(2);
        }