コード例 #1
0
        public void GetChainFromExpression_should_return_a_chain()
        {
            // Arrange
            var builder = new ValidationBuilder<Order, string>(x => x.OrderDetails[0].ProductCode);
            builder.UpdateContainerName("The.Order");

            // Action
            var name = builder.ChainName;

            // Assert
            Assert.That(name, Is.EqualTo("The.Order.OrderDetails[0].ProductCode"));
        }
コード例 #2
0
        public void ChainName_should_return_container_name_if_cannot_resolve_value_from_expression()
        {
            // Arrange
            var builder = new ValidationBuilder<Order, string>(null);
            builder.UpdateContainerName("The.Order");

            // Action
            var name = builder.ChainName;

            // Assert
            Assert.That(name, Is.EqualTo("The.Order"));
        }
コード例 #3
0
        public void GetChainFromExpression_should_return_a_container_if_expression_type_is_not_member_access()
        {
            // Arrange
            var builder = new ValidationBuilder <Order, string>(x => "Not A Member Access Expression");

            builder.UpdateContainerName("The.Order.OrderDetails[0].Id");

            // Action
            var name = builder.ChainName;

            // Assert
            Assert.That(name, Is.EqualTo("The.Order.OrderDetails[0].Id"));
        }
コード例 #4
0
        public void GetChainFromExpression_should_return_a_chain()
        {
            // Arrange
            var builder = new ValidationBuilder <Order, string>(x => x.OrderDetails[0].ProductCode);

            builder.UpdateContainerName("The.Order");

            // Action
            var name = builder.ChainName;

            // Assert
            Assert.That(name, Is.EqualTo("The.Order.OrderDetails[0].ProductCode"));
        }
コード例 #5
0
        public void ChainName_should_return_container_name_if_cannot_resolve_value_from_expression()
        {
            // Arrange
            var builder = new ValidationBuilder <Order, string>(null);

            builder.UpdateContainerName("The.Order");

            // Action
            var name = builder.ChainName;

            // Assert
            Assert.That(name, Is.EqualTo("The.Order"));
        }
コード例 #6
0
        public void ContainerName_when_set_will_update_chain_name()
        {
            // Arrange
            var builder = new ValidationBuilder<Order, string>(null);
            builder.ChainName = "Chain.Name";
            Assert.That(builder.ChainName, Is.EqualTo("Chain.Name"));
            builder.UpdateContainerName("The.Order");

            // Action
            var name = builder.ChainName;

            // Assert
            Assert.That(name, Is.EqualTo("The.Order"));
        }
コード例 #7
0
        public void ContainerName_when_set_will_update_chain_name()
        {
            // Arrange
            var builder = new ValidationBuilder <Order, string>(null);

            builder.ChainName = "Chain.Name";
            Assert.That(builder.ChainName, Is.EqualTo("Chain.Name"));
            builder.UpdateContainerName("The.Order");

            // Action
            var name = builder.ChainName;

            // Assert
            Assert.That(name, Is.EqualTo("The.Order"));
        }
コード例 #8
0
        public void GetChainFromExpression_should_return_a_container_if_expression_type_is_not_member_access()
        {
            // Arrange
            var builder = new ValidationBuilder<Order, string>(x => "Not A Member Access Expression");
            builder.UpdateContainerName("The.Order.OrderDetails[0].Id");

            // Action
            var name = builder.ChainName;

            // Assert
            Assert.That(name, Is.EqualTo("The.Order.OrderDetails[0].Id"));
        }