public async void Create()
        {
            Mock <ILogger <TransactionRepository> > loggerMoc = TransactionRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = TransactionRepositoryMoc.GetContext();
            var repository = new TransactionRepository(loggerMoc.Object, context);

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

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

            record.Should().NotBeNull();
        }
Пример #2
0
        public async void Create()
        {
            Mock <ILogger <TransactionRepository> > loggerMoc = TransactionRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = TransactionRepositoryMoc.GetContext();
            var repository = new TransactionRepository(loggerMoc.Object, context);

            var entity = new Transaction();

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

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

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