Example #1
0
        public void Constructor_should_create_selective_constraint()
        {
            var fuelType = 1;
            var pet      = new Option("Petroleum", 1);
            var gas      = new Option("Gasoline", 2);
            var options  = new List <Option>()
            {
                pet, gas
            };

            var constraint = new SelectiveConstraint(fuelType, options);

            constraint.ConstraintId.Should().Be(fuelType);
            constraint.Options.Should().BeEquivalentTo(options);
        }
Example #2
0
        public void Validate_should_return_false_if_value_is_not_present_in_keys()
        {
            var fuelType = 1;
            var pet      = new Option("Petroleum", 1);
            var gas      = new Option("Gasoline", 2);
            var options  = new List <Option>()
            {
                pet, gas
            };
            var constraint = new SelectiveConstraint(fuelType, options);
            var value      = 10;

            var result = constraint.Validate(value);

            result.Should().BeFalse();
        }