Esempio n. 1
0
        public async void Create()
        {
            Mock <ILogger <HandlerRepository> > loggerMoc = HandlerRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = HandlerRepositoryMoc.GetContext();
            var repository = new HandlerRepository(loggerMoc.Object, context);

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

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

            record.Should().NotBeNull();
        }
        public async void Create()
        {
            Mock <ILogger <HandlerRepository> > loggerMoc = HandlerRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = HandlerRepositoryMoc.GetContext();
            var repository = new HandlerRepository(loggerMoc.Object, context);

            var entity = new Handler();

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

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

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