本文整理汇总了C#中ITest.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ITest.GetType方法的具体用法?C# ITest.GetType怎么用?C# ITest.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITest
的用法示例。
在下文中一共展示了ITest.GetType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunTest
protected static void RunTest(ITest test)
{
int loops = Calibrate(test, TimeSpan.FromMilliseconds(1000));
var sw = new Stopwatch();
GC.Collect();
GC.WaitForPendingFinalizers();
var c1 = GC.CollectionCount(0);
var c2 = GC.CollectionCount(1);
var c3 = GC.CollectionCount(2);
sw.Start();
test.DoTest(loops);
sw.Stop();
c1 = GC.CollectionCount(0) - c1;
c2 = GC.CollectionCount(1) - c2;
c3 = GC.CollectionCount(2) - c3;
var lps = (int)(loops / (sw.ElapsedMilliseconds / 1000.0));
Console.WriteLine("{0,-40} {1,20} loops/s, collections {2}/{3}/{4}",
test.GetType().Name, lps,
c1, c2, c3);
}
示例2: Run
public void Run(ITest test)
{
Console.WriteLine("******************* Start {0} *******************", test.GetType().Name);
PrintMemorySize("first");
test.Initialize();
for (int i = 0; i < TestCount; i++)
{
test.Do(i);
if (i % PrintCount == 0)
{
PrintMemorySize("do(" + i + ")");
}
}
test.Cleanup();
PrintMemorySize("last");
Console.WriteLine("******************* Finish {0} *******************", test.GetType().Name);
}
示例3: Add
public TestMonitor Add(ITest test)
{
var key = test.GetType().FullName;
var keyFormat = key + ".{0}";
var i = 1;
while (!tests.TryAdd(key, test))
{
key = string.Format(keyFormat, i);
i++;
}
var monitor = monitors.GetOrAdd(key, (k) =>
{
var m = new TestMonitor(this, k, test) { HttpContext = this.HttpContext };
m.Started += OnTestStarted;
m.Completed += OnTestCompleted;
m.EventReceived += OnTestEventReceived;
m.ProgressChanged += OnProgressChanged;
return m;
});
return monitor;
}
示例4: GetTestSummary
// NOTE: When test.ToString() displays something less stupid than
// MethodName(Namespace.ClassName) think about changing to that. As it
// is now its impossible to sort the test output.
// The workaround is to use this method.
private static string GetTestSummary(ITest test) {
string nunitInfo = test.ToString();
return test.GetType().Name + "." + nunitInfo.Substring(0, nunitInfo.IndexOf('('));
}
示例5: StartTest
public void StartTest(ITest test) {
_testStartTime = DateTime.Now;
_currentTest = _document.CreateElement(ElementTestCase);
_currentTest.SetAttribute(AttributeName, ((TestCase ) test).ToString());
string className = test.GetType().FullName;
_currentTest.SetAttribute(AttributeClassname, className);
_suiteElement.AppendChild(_currentTest);
}