public void can_get_empty_boolean_from_form()
        {
            var collection = new NameValueCollection { { "text", "blah" } };

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

            Expect(value, Is.False);
        }
        public void throws_invalidoperationexception_when_lookup_has_multiple_values()
        {
            var collection = new NameValueCollection { { "state", "CA" }, { "state", "BC" } };

            Expect(() => collection.GetValueOrDefault<string>("state"), Throws.InvalidOperationException);
        }
        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_boolean_from_form()
        {
            var collection = new NameValueCollection { { "radio", "on" } };

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

            Expect(value, Is.True);
        }
 public void Can_get_value_from_settings()
 {
     var settings = new NameValueCollection { { "butter", "300" } };
     var result = settings.GetValueOrDefault("butter", 1);
     result.Should().Be(300);
 }
 public void Can_get_default_if_settings_doesnt_exist()
 {
     var settings = new NameValueCollection();
     var result = settings.GetValueOrDefault("butter", 1);
     result.Should().Be(1);
 }