コード例 #1
0
    public GetCustomersOutput GetCustomers(GetCustomersInput input)
    {
        //Called specific GetAllWithInsurance method of Customer repository.
        var customers = _customerRepository.GetAllWithInsurance(input.SelectedInsuranceId);

        //Used AutoMapper to automatically convert List<Customer> to List<CustomerDto>.
        return new GetCustomersOutput
                {
                    Customers = customers.MapTo<List<CustomerDto>>()
                };
    }
コード例 #2
0
        public void Should_Get_All_Customers_WithInsurance()
        {
            var isaacAsimov = GetCustomer("Isaac","Asimov");

            var getCustomerInput = new GetCustomersInput()
            {
                SelectedInsuranceId =isaacAsimov.SelectedInsuranceId
            };

            var output = _customerAppService.GetCustomers(getCustomerInput);
            output.Customers.Count.ShouldBe(3);
        }