コード例 #1
0
        public void Registered_At_CheckFactory()
        {
            var checkType = typeof(RequiredCheck);
            var settings  = new Dictionary <string, string>();

            var sut = new CheckFactory();

            var checkDefinition = new CheckDefinition {
                Type = "required", Settings = settings
            };

            var check = sut.CreateCheck(checkDefinition, new FieldDefinition {
                Key = "key1"
            });

            check.Should().NotBeNull();
            check.Should().BeOfType(checkType);
        }
コード例 #2
0
        public void Registered_At_CheckFactory()
        {
            var settings = new Dictionary <string, string> {
                { "Min", "2" }, { "Max", "6" }
            } as IDictionary <string, string>;
            var checkType = typeof(StringLengthCheck);

            var sut = new CheckFactory();

            var checkDefinition = new CheckDefinition {
                Type = "length", Settings = settings
            };
            var check = sut.CreateCheck(checkDefinition, new FieldDefinition {
                Key = "key1"
            });

            check.Should().NotBeNull();
            check.Should().BeOfType(checkType);
        }
コード例 #3
0
        public void Registered_At_CheckFactory()
        {
            var settings =
                new Dictionary <string, string>
            {
                { "Hint", "this is the hint" }, { "RegEx", "false|true" }
            } as IDictionary <string, string>;
            var checkType = typeof(StringRegExCheck);

            var sut = new CheckFactory();

            var checkDefinition = new CheckDefinition {
                Type = "regex", Settings = settings
            };
            var check = sut.CreateCheck(checkDefinition, new FieldDefinition {
                Key = "key1"
            });

            check.Should().NotBeNull();
            check.Should().BeOfType(checkType);
        }