Пример #1
0
        public TransactionTests()
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(new WebApi.Mappings.AutoMapper());
            });
            var mapper           = config.CreateMapper();
            var transactionsData = new List <Data.Entities.Transaction>
            {
                new Data.Entities.Transaction()
                {
                    ToAccount     = Guid.NewGuid(),
                    FromAccount   = Guid.NewGuid(),
                    TransactionId = Guid.Parse("96DAF25B-F86A-4A76-8E03-91B9C1AA7C6C"),
                    Amount        = 20,
                    Date          = DateTime.Now,
                    FailureReason = "",
                    Status        = (Data.Entities.Status) 1
                }
            }.AsQueryable();
            var context = new Mock <TransactionContext>();

            context.SetupGet(x => x.Transactions).Returns(MockDBSetExtensions.GetDbSet(transactionsData).Object);
            var transactionRepository = new TransactionRepository(context.Object, mapper);

            _service = new TransactionService(transactionRepository);
        }
Пример #2
0
        public UpdateTransactionTests()
        {
            var transactionsData = new List <Data.Entities.Transaction>
            {
                new Data.Entities.Transaction()
                {
                    ToAccount     = Guid.NewGuid(),
                    FromAccount   = Guid.NewGuid(),
                    TransactionId = Guid.Parse("96DAF25B-F86A-4A76-8E03-91B9C1AA7C6C"),
                    Amount        = 20,
                    Date          = DateTime.Now,
                    FailureReason = "",
                    Status        = (Data.Entities.Status) 1
                }
            }.AsQueryable();
            var context = new Mock <TransactionContext>();

            context.SetupGet(x => x.Transactions).Returns(MockDBSetExtensions.GetDbSet(transactionsData).Object);
            var transactionRepository = new UpdateTransactionRepository(context.Object);

            _service = new UpdateTransactionService(transactionRepository);
        }