Пример #1
0
        internal AdvisorDto GetAdvisorById(int id)
        {
            SIAdvisorRepository advisorRepository = new SIAdvisorRepository();
            SIRepository        repository        = new SIRepository();
            IDtoCreator <Advisor, AdvisorDto> advisorDtoCreator = new AdvisorDtoCreator();

            repository.GetObject <Advisor>((x) => _advisors.SingleOrDefault(a => a.Id == (int)x));

            AdvisorServices advisorServices = new AdvisorServices(repository, advisorRepository, advisorDtoCreator);
            var             result          = advisorServices.GetAdvisorById(id);

            return(result);
        }
Пример #2
0
        public void SaveCustomer(CustomerDto customerDto)
        {
            SIRepository repository = new SIRepository();

            repository.GetObject((x) => { return(new Customer()); });
            SIAccountServices accountServices = new SIAccountServices();
            IDtoCreator <Customer, CustomerDto> custCreator = new CustomerDtoCreator();

            SICustomerRepository customerRepository = new SICustomerRepository();
            CustomerServices     services           = new CustomerServices(customerRepository, repository, accountServices, custCreator);

            services.SaveCustomer(customerDto);
        }
Пример #3
0
        public void MakeTransfer(int debitAccountId, int creditAccountId, decimal amount, string motif)
        {
            PexAssume.IsTrue(amount > 100);

            var repository = new SIRepository();
            repository.GetObject<Account>((x) => _accounts.SingleOrDefault(a => a.Id == (int)x));

            var operationRepository = new SIOperationRepository();
            var operationCreator = new OperationDtoCreator();

            //act
            var operationServices = new OperationServices(operationRepository, repository, operationCreator);
            operationServices.MakeTransfer(debitAccountId, creditAccountId, amount, motif);
        }
Пример #4
0
        public void MakeTransfer(int debitAccountId, int creditAccountId, decimal amount, string motif)
        {
            PexAssume.IsTrue(amount > 100);

            var repository = new SIRepository();

            repository.GetObject <Account>((x) => _accounts.SingleOrDefault(a => a.Id == (int)x));

            var operationRepository = new SIOperationRepository();
            var operationCreator    = new OperationDtoCreator();

            //act
            var operationServices = new OperationServices(operationRepository, repository, operationCreator);

            operationServices.MakeTransfer(debitAccountId, creditAccountId, amount, motif);
        }
Пример #5
0
        public CustomerDto GetCustomerById(int id)
        {
            var repository         = new SIRepository();
            var customerRepository = new SICustomerRepository();
            var accountServices    = new SIAccountServices();
            var custCreator        = new CustomerDtoCreator();

            repository.GetObject <Customer>((x) => _customers.SingleOrDefault(c => c.Id == (int)x));

            CustomerServices services = new CustomerServices(customerRepository, repository, accountServices, custCreator);
            var result = services.GetCustomerById(id);

            //asert

            PexAssert.Case(id == _customers[0].Id).Implies(() => result.Email == _customers[0].Email);
            return(result);
        }
Пример #6
0
        public IList <CustomerDto> GetCustomersForAdvisor(int advisorID)
        {
            SIRepository         repository                 = new SIRepository();
            SICustomerRepository customerRepository         = new SICustomerRepository();
            SIAccountServices    accountServices            = new SIAccountServices();
            IDtoCreator <Customer, CustomerDto> custCreator = new CustomerDtoCreator();


            repository.GetObject <Advisor>((x) => _advisors.SingleOrDefault(a => a.Id == (int)x));

            //act
            CustomerServices    customerServices = new CustomerServices(customerRepository, repository, accountServices, custCreator);
            IList <CustomerDto> result           = customerServices.GetCustomersForAdvisor(advisorID);

            PexAssert.Case(advisorID == _advisors[0].Id).Implies(() => result.Count == _advisors[0].Customers.Count);
            return(result);
        }
Пример #7
0
        public void SaveCustomer(CustomerDto customerDto)
        {
            SIRepository repository = new SIRepository();
            repository.GetObject((x) => { return new Customer(); });
            SIAccountServices accountServices = new SIAccountServices();
            IDtoCreator<Customer, CustomerDto> custCreator = new CustomerDtoCreator();

            SICustomerRepository customerRepository = new SICustomerRepository();
            CustomerServices services = new CustomerServices(customerRepository, repository, accountServices, custCreator);
            services.SaveCustomer(customerDto);
        }
Пример #8
0
        public IList<CustomerDto> GetCustomersForAdvisor(int advisorID)
        {
            SIRepository repository = new SIRepository();
            SICustomerRepository customerRepository = new SICustomerRepository();
            SIAccountServices accountServices = new SIAccountServices();
            IDtoCreator<Customer, CustomerDto> custCreator = new CustomerDtoCreator();

            repository.GetObject<Advisor>((x) => _advisors.SingleOrDefault(a => a.Id == (int)x));

            //act
            CustomerServices customerServices = new CustomerServices(customerRepository, repository,accountServices,custCreator);
            IList<CustomerDto> result = customerServices.GetCustomersForAdvisor(advisorID);

            PexAssert.Case(advisorID == _advisors[0].Id).Implies(() => result.Count == _advisors[0].Customers.Count);
            return result;
        }
Пример #9
0
        public CustomerDto GetCustomerById(int id)
        {
            var repository = new SIRepository();
            var customerRepository = new SICustomerRepository();
            var accountServices = new SIAccountServices();
            var custCreator = new CustomerDtoCreator();

            repository.GetObject<Customer>((x) => _customers.SingleOrDefault(c=>c.Id == (int)x));

            CustomerServices services = new CustomerServices(customerRepository, repository,accountServices,custCreator);
            var result = services.GetCustomerById(id);
            //asert

            PexAssert.Case(id == _customers[0].Id).Implies(() => result.Email == _customers[0].Email);
            return result;
        }