Ejemplo n.º 1
0
 internal static bool IsQueryString(this KeyValuePair <string, object> keyValue, out List <Item> queryString)
 {
     queryString = null;
     if (!keyValue.Is("querystring"))
     {
         return(false);
     }
     queryString = keyValue.ToItemList();
     return(true);
 }
Ejemplo n.º 2
0
 internal static bool IsForm(this KeyValuePair <string, object> keyValue, out List <Item> form)
 {
     form = null;
     if (!keyValue.Is("form"))
     {
         return(false);
     }
     form = keyValue.ToItemList();
     return(true);
 }
Ejemplo n.º 3
0
        internal static bool IsServerVariables(this KeyValuePair <string, object> keyValue, out List <Item> serverVariables)
        {
            serverVariables = null;
            if (!keyValue.Is("servervariables"))
            {
                return(false);
            }

            serverVariables = keyValue.ToItemList();
            return(true);
        }
Ejemplo n.º 4
0
        internal static bool Is(this KeyValuePair <string, object> keyValue, string field, out string result)
        {
            result = null;
            if (!keyValue.Is(field))
            {
                return(false);
            }

            result = keyValue.Value?.ToString();
            return(true);
        }
Ejemplo n.º 5
0
        internal static bool IsCookies(this KeyValuePair <string, object> keyValue, out List <Item> cookies)
        {
            cookies = null;
            if (!keyValue.Is("cookies"))
            {
                return(false);
            }

            cookies = keyValue.ToItemList();
            return(true);
        }
Ejemplo n.º 6
0
        public void IsTest_ShouldReturnFalse_IfKeyOrValueIsDifferent02()
        {
            // Arrange
            var entry1 = new KeyValuePair <string, int>("kakikukeko", 10);
            var entry2 = new KeyValuePair <string, int>("aiueo", 10);

            // Act
            var result = entry1.Is(entry2);

            // Assert
            Assert.IsFalse(result);
        }
Ejemplo n.º 7
0
        public void IsTest_ShouldReturnTrue_IfKeyAndValueAreEquivalent()
        {
            // Arrange
            var entry1 = new KeyValuePair <string, int>("aiueo", 10);
            var entry2 = new KeyValuePair <string, int>("aiueo", 10);

            // Act
            var result = entry1.Is(entry2);

            // Assert
            Assert.IsTrue(result);
        }
Ejemplo n.º 8
0
        public void IsTest_ShouldReturnTrue_IfKeyAndValueAreEquivalent()
        {
            // Arrange
            var entry1 = new KeyValuePair<string, int>("aiueo", 10);
            var entry2 = new KeyValuePair<string, int>("aiueo", 10);

            // Act
            var result = entry1.Is(entry2);

            // Assert
            Assert.IsTrue(result);
        }
Ejemplo n.º 9
0
        public void IsTest_ShouldReturnFalse_IfKeyOrValueIsDifferent02()
        {
            // Arrange
            var entry1 = new KeyValuePair<string, int>("kakikukeko", 10);
            var entry2 = new KeyValuePair<string, int>("aiueo", 10);

            // Act
            var result = entry1.Is(entry2);

            // Assert
            Assert.IsFalse(result);
        }
 internal static bool IsStatusCode(this KeyValuePair <string, object> keyValue, out int?statusCode)
 {
     statusCode = null;
     if (!keyValue.Is("statuscode"))
     {
         return(false);
     }
     if (keyValue.Value == null || string.IsNullOrWhiteSpace(keyValue.Value.ToString()))
     {
         return(false);
     }
     if (!int.TryParse(keyValue.Value.ToString(), out int code))
     {
         return(false);
     }
     statusCode = code;
     return(true);
 }
 internal static bool IsType(this KeyValuePair <string, object> keyValue, out string type)
 {
     return(keyValue.Is("type", out type));
 }
 internal static bool IsVersion(this KeyValuePair <string, object> keyValue, out string version)
 {
     return(keyValue.Is("version", out version));
 }
 internal static bool IsUrl(this KeyValuePair <string, object> keyValue, out string url)
 {
     return(keyValue.Is("url", out url));
 }
 internal static bool IsMethod(this KeyValuePair <string, object> keyValue, out string method)
 {
     return(keyValue.Is("method", out method));
 }
 internal static bool IsUser(this KeyValuePair <string, object> keyValue, out string user)
 {
     return(keyValue.Is("user", out user));
 }
 internal static bool IsHostname(this KeyValuePair <string, object> keyValue, out string hostname)
 {
     return(keyValue.Is("hostname", out hostname));
 }
 internal static bool IsSource(this KeyValuePair <string, object> keyValue, out string source)
 {
     return(keyValue.Is("source", out source));
 }
 internal static bool IsApplication(this KeyValuePair <string, object> keyValue, out string application)
 {
     return(keyValue.Is("application", out application));
 }