public static bool IsParamsValid(this SqlServerRequestHandler Handler, HttpMethod Method, HttpContext Context) { bool IsValid = false; string[] RequiredParameters; if (Method.Equals(HttpMethod.Post)) { RequiredParameters = new string[] { "EntryKey", "StoreUsername", "EntryName", "EntryUse" } } ; else { RequiredParameters = new string[] { "EntryKey", "StoreUsername" } }; foreach (string Parameter in RequiredParameters) { if (Context.Request.Query.TryGetValue(Parameter, out var ParamValue)) { if (!ParamValue.ToString().Equals("")) { IsValid = true; } } } return(IsValid); }
XmlNode ParamValue2Node(ParamValue value) { XmlNode xmlNode = xml.CreateElement(value.TypeKey.ToString()); XmlText text = xml.CreateTextNode(value.ToString(hashToStringLabels)); xmlNode.AppendChild(text); return(xmlNode); }
public void TestToString() { // Arrange var excpectedKey = ParamValue.Param.token; var expectedValue = "test-token"; var paramValue = new ParamValue(excpectedKey, expectedValue); var expected = $"Param({excpectedKey}, {expectedValue})"; // Act var actual = paramValue.ToString(); // Assert Assert.AreEqual(expected, actual); }