Exemple #1
0
        public IQueryable <CheckingAccount> GetAll(CheckingAccountQuery query)
        {
            IQueryable <CheckingAccount> result;

            if (query == null)
            {
                result = _checkingAccountRepository.GetAll(null);
            }
            else
            {
                result = _checkingAccountRepository.GetAll(query.Quantity);
            }

            return(result);
        }
Exemple #2
0
        public IHttpActionResult Get()
        {
            var queryString = Request.GetQueryNameValuePairs()
                              .Where(x => x.Key.Equals("quantity"))
                              .FirstOrDefault();

            CheckingAccountQuery query = null;

            if (queryString.Key != null)
            {
                query          = new CheckingAccountQuery();
                query.Quantity = int.Parse(queryString.Value);
            }

            var result = _accountsService.GetAll(query).ProjectTo <CheckingAccountViewModel>();;

            return(HandleQueryable <CheckingAccountViewModel>(result));
        }
Exemple #3
0
        public void CheckingAccounts_Service_GetAll_Should_Be_OK()
        {
            //Arrange
            var list          = new List <CheckingAccount>();
            var checkingQuery = new CheckingAccountQuery();

            checkingQuery = null;
            IQueryable <CheckingAccount> query = list.AsQueryable();

            _mockRepositoryAccount.Setup(r => r.GetAll(null))
            .Returns(query);

            //Action
            var listReturn = _service.GetAll(checkingQuery);

            //Verify
            listReturn.Count().Should().Be(query.Count());
            _mockRepositoryAccount.Verify(r => r.GetAll(null));
        }
Exemple #4
0
        public void CheckingAccounts_Service_GetAll_With_Quantity_Should_Be_Ok()
        {
            //Arrange
            List <CheckingAccount> list          = new List <CheckingAccount>();
            CheckingAccountQuery   checkingQuery = new CheckingAccountQuery();
            int quantity = 5;

            checkingQuery.Quantity = quantity;
            IQueryable <CheckingAccount> query = list.AsQueryable();

            _mockRepositoryAccount.Setup(r => r.GetAll(quantity))
            .Returns(query);

            //Action
            IQueryable <CheckingAccount> listReturn = _service.GetAll(checkingQuery);

            //Verify
            listReturn.Count().Should().Be(query.Count());
            _mockRepositoryAccount.Verify(r => r.GetAll(quantity));
            _mockRepositoryAccount.VerifyNoOtherCalls();
        }
Exemple #5
0
        public void Initialize()
        {
            AutoMapperInitializer.Reset();
            AutoMapperInitializer.Initialize();
            _accountQuery            = new CheckingAccountQuery();
            _checkingAccountRegister = new Mock <CheckingAccountRegisterCommand>();
            _checkingAccountRemove   = new Mock <CheckingAccountRemoveCommand>();
            _checkingAccountUpdate   = new Mock <CheckingAccountUpdateCommand>();
            HttpRequestMessage request = new HttpRequestMessage();

            request.SetConfiguration(new HttpConfiguration());
            _checkingAccountServiceMock    = new Mock <ICheckingAccountService>();
            _checkingAccountRepositoryMock = new Mock <ICheckingAccountRepository>();
            _clientRepositoryMock          = new Mock <IClientRepository>();
            _checkingAccountsController    = new CheckingAccountsController(_checkingAccountServiceMock.Object)
            {
                Request          = request,
                _accountsService = _checkingAccountServiceMock.Object,
            };
            _checkingAccount           = new Mock <CheckingAccount>();
            _accountTransactionCommand = new Mock <CheckingAccountTransactionCommand>();
        }