本文整理汇总了C#中Microsoft.VisualStudio.TestPlatform.UnitTestFramework.OrderBy方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.VisualStudio.TestPlatform.UnitTestFramework.OrderBy方法的具体用法?C# Microsoft.VisualStudio.TestPlatform.UnitTestFramework.OrderBy怎么用?C# Microsoft.VisualStudio.TestPlatform.UnitTestFramework.OrderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.VisualStudio.TestPlatform.UnitTestFramework
的用法示例。
在下文中一共展示了Microsoft.VisualStudio.TestPlatform.UnitTestFramework.OrderBy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AsyncStorageModule_multiRemove_Method
public void AsyncStorageModule_multiRemove_Method()
{
var module = new AsyncStorageModule();
var waitHandle = new AutoResetEvent(false);
var error = default(JObject);
var result = default(JArray);
var callback = new MockCallback(res =>
{
error = res.Length > 0 ? (JObject)res[0] : null;
result = res.Length > 1 ? (JArray)res[1] : null;
waitHandle.Set();
});
var array = new[]
{
new[] { "test1", "1" },
new[] { "test2", "2" },
new[] { "test3", "3" },
new[] { "test4", "4" },
new[] { "test5", "5" },
new[] { "test6", "6" },
};
module.clear(callback);
Assert.IsTrue(waitHandle.WaitOne());
Assert.IsNull(error);
Assert.IsNull(result);
module.multiSet(array, callback);
Assert.IsTrue(waitHandle.WaitOne());
Assert.IsNull(error);
Assert.IsNull(result);
module.getAllKeys(callback);
Assert.IsTrue(waitHandle.WaitOne());
Assert.IsNull(error);
Assert.AreEqual(result.Count, 6);
var strArray = new string[result.Count];
int idx = 0;
foreach (var item in result)
{
strArray[idx++] = item.Value<string>();
}
module.multiGet(strArray, callback);
Assert.IsTrue(waitHandle.WaitOne());
Assert.IsNull(error);
var expected = array.OrderBy(p => p[0]).Aggregate("", (acc, p) => $"{p[0]},{p[1]};");
var actual = result.OrderBy(p => p[0]).Aggregate("", (acc, p) => $"{p[0]},{p[1]};");
Assert.AreEqual(expected, actual);
var keys = new string[]
{
"test1",
"test2",
};
module.multiRemove(keys, callback);
Assert.IsTrue(waitHandle.WaitOne());
Assert.IsNull(error);
Assert.IsNull(result);
module.getAllKeys(callback);
Assert.IsTrue(waitHandle.WaitOne());
Assert.IsNull(error);
Assert.AreEqual(result.Count, 4);
}