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 }));
        }
        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 });
        }
        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);
            
        }
Exemple #4
0
        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");
        }
        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");
            
        }