Exemple #1
0
        public void can_get_boolean_from_form()
        {
            var collection = new NameValueCollection {
                { "radio", "on" }
            };

            var value = collection.GetValueOrDefault("radio", CollectionExtensions.GetFlexibleBooleanParsingFunction());

            Expect(value, Is.True);
        }
Exemple #2
0
        public void flexible_boolean_parsing_is_case_insensitive()
        {
            var collection = new NameValueCollection {
                { "question", "YES" }
            };

            var value = collection.GetValueOrDefault("question", CollectionExtensions.GetFlexibleBooleanParsingFunction("yes"));

            Expect(value, Is.True);
        }
        public void can_get_empty_boolean_from_form()
        {
            var collection = new NameValueCollection {
                { "text", "blah" }
            };

            var value = collection.GetValueOrDefault("radio", CollectionExtensions.GetFlexibleBooleanParsingFunction());

            this.Expect(value, Is.False);
        }