コード例 #1
0
        public void ShouldMatch_WithDestinationAndDynamic_ShouldThrowException()
        {
            var converter = new CustomerRequestCustomerConverter();

            var request = new CustomerRequest { Age = 15 };

            Should.Throw<ConverterException>(() => converter.ShouldMatch(request, new Customer(), new {}, new Func<Customer, bool>[] { x => x.Age == 0 }));
        }
コード例 #2
0
        public void ShouldMatch_WithDestinationAndDynamic_ShouldNotThrowException()
        {
            var converter = new CustomerRequestCustomerConverter();

            var request = new CustomerRequest { Age = 15 };

            converter.ShouldMatch(request, new Customer(), new {}, new Func<Customer, bool>[] { x => x.Age == request.Age });
        }
コード例 #3
0
        public void Convert_With_ShouldBe()
        {
            var request = new CustomerRequest
                          {
                              Age = 18,
                              Name = "Name"
                          };
            var customer = _modelConverter.Convert<CustomerRequest, Customer>(request);

            customer.Age.ShouldBe(request.Age);

            customer.Name.ShouldBe(request.Name);
            
        }
コード例 #4
0
ファイル: Tests.cs プロジェクト: raulnq/Jal.Converter
        public void Convert_WithCustomerRequestToCustomer_ShouldBe(string name, int age)
        {
            var customerRequest = new CustomerRequest
            {
                Name = name,
                Age = age
            };
            var customer = _modelConverter.Convert<CustomerRequest, Customer>(customerRequest);

            customer.Name.ShouldBe(customerRequest.Name);

            customer.Age.ShouldBe(customerRequest.Age);

            customer.Category.ShouldBe("None");
        }
コード例 #5
0
        public void Convert_WithDestination_ShouldBe()
        {
            var request = new CustomerRequest
            {
                Age = 18,
                Name = "Name"
            };
            var customer = new Customer
                           {
                               Category = "Category"
                           };
            var sameCustomer = _modelConverter.Convert(request, customer);

            sameCustomer.Age.ShouldBe(request.Age);

            sameCustomer.Name.ShouldBe(request.Name);

            sameCustomer.Category.ShouldBe("Category");
            
        }