本文整理汇总了C#中QueryString.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# QueryString.Remove方法的具体用法?C# QueryString.Remove怎么用?C# QueryString.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryString
的用法示例。
在下文中一共展示了QueryString.Remove方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
public ActionResult Process(HttpRequestBase request, ModelStateDictionary modelState)
{
IpnVerificationBinder binder = new IpnVerificationBinder();
Transaction tx = binder.Bind(request.Form, modelState);
ContentResult cr = new ContentResult();
cr.ContentEncoding = Encoding.UTF8;
cr.ContentType = "text/html";
cr.Content = "INVALID";
if (tx != null)
{
Transaction dbTx = m_txRepository.GetAll().Where(x => x.Tx == tx.Tx).FirstOrDefault();
if (dbTx != null)
{
string expected = dbTx.ToIpnQueryString().ToString();
QueryString actualQs = new QueryString();
actualQs.Add(request.Form);
actualQs.Remove("cmd");
string actual = actualQs.ToString();
if (expected == actual)
{
cr.Content = "VERIFIED";
}
}
}
return cr;
}
示例2: TestCount
public void TestCount()
{
QueryString qs = new QueryString();
Assert.AreEqual(0, qs.Count());
qs.Add("name", "Andrew");
Assert.AreEqual(1, qs.Count());
qs.Add("age", "22");
Assert.AreEqual(2, qs.Count());
qs.Add("name", "Lei");
Assert.AreEqual(3, qs.Count());
qs.Set("name", "Thomas");
Assert.AreEqual(2, qs.Count());
qs.Add("name", "Matt");
Assert.AreEqual(3, qs.Count());
qs.Remove("name", "Matt");
Assert.AreEqual(2, qs.Count());
qs.Remove("name", "Thomas");
Assert.AreEqual(1, qs.Count());
qs.Remove("age");
Assert.AreEqual(0, qs.Count());
qs.Add("name", "Andrew");
qs.Add("name", "Lei");
Assert.AreEqual(2, qs.Count());
qs.RemoveAll("name");
Assert.AreEqual(0, qs.Count());
}
示例3: TestRemoveWithValue_MultipleKeys
public void TestRemoveWithValue_MultipleKeys()
{
QueryString qs = new QueryString()
{
{ "name", "Andrew" },
{ "name", "Lei" }, // to be removed
{ "name", "Thomas" },
{ "name", "Lei" },
{ "age", "22" }
};
Assert.IsFalse(qs.Remove("name", null));
Assert.IsFalse(qs.Remove("name", "andrew"));
Assert.IsFalse(qs.Remove("name", "Matt"));
Assert.IsTrue(qs.Remove("name", "Lei"));
AssertEqual(new QueryString()
{
{ "name", "Andrew" }, // to be removed
{ "name", "Thomas" },
{ "name", "Lei" },
{ "age", "22" }
}, qs);
Assert.IsTrue(qs.Remove("name", "Andrew"));
AssertEqual(new QueryString()
{
{ "name", "Thomas" },
{ "name", "Lei" }, // to be removed
{ "age", "22" }
}, qs);
Assert.IsFalse(qs.Remove("name", "Andrew"));
Assert.IsTrue(qs.Remove("name", "Lei"));
AssertEqual(new QueryString()
{
{ "name", "Thomas" },
{ "age", "22" }
}, qs);
Assert.IsFalse(qs.Remove("name", "Lei"));
}
示例4: TestRemove_TwoKeys
public void TestRemove_TwoKeys()
{
QueryString qs = new QueryString()
{
{ "name", "Andrew" },
{ "age", "22" },
{ "age", "23" }
};
Assert.IsTrue(qs.Remove("age"));
AssertEqual(new QueryString()
{
{ "name", "Andrew" },
{ "age", "23" }
}, qs);
Assert.IsTrue(qs.Remove("age"));
AssertEqual(new QueryString()
{
{ "name", "Andrew" }
}, qs);
Assert.IsFalse(qs.Remove("age"));
}
示例5: TestRemoveWithValue_OnlyKey
public void TestRemoveWithValue_OnlyKey()
{
QueryString qs = new QueryString()
{
{ "name", "Andrew" },
{ "age", "22" }
};
Assert.IsFalse(qs.Remove("age", null));
Assert.IsFalse(qs.Remove("age", "21"));
Assert.IsTrue(qs.Remove("age", "22"));
AssertEqual(new QueryString()
{
{ "name", "Andrew" }
}, qs);
Assert.IsFalse(qs.Remove("age", "22"));
}