本文整理汇总了C#中TestType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# TestType.ToString方法的具体用法?C# TestType.ToString怎么用?C# TestType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestType
的用法示例。
在下文中一共展示了TestType.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Big_long_expressions_work
public void Big_long_expressions_work(TestState testState, TestType testType, string expected)
{
var actual = _queryStringBuilder
.QueryStringWith(testState == TestState.All ? "" : "state=" + testState.ToString().EnumNameToTransportCase())
.AndWith(testType == TestType.All ? "" : "type=" + testType.ToString().EnumNameToTransportCase())
.Build();
actual.Should().Be(expected);
}
示例2: CreateTestResult
public TestResult CreateTestResult(TestType type, string fullName,
ResultState state = ResultState.Success,
Func<IEnumerable<TestResult>> children = null,
string stackTrace = null,
string description = null,
IList categories = null,
string agentName = null)
{
description = description ?? RandomValuesGenerator.GetRandomValue<string>();
agentName = agentName ?? RandomValuesGenerator.GetRandomValue<string>();
var splitted = (fullName ?? string.Empty).Split(new[]{'.'}, StringSplitOptions.RemoveEmptyEntries);
var childResults = children != null ? children() : new TestResult[0];
var testResult = new TestResult(new TestInfoWrapper
{
TestName = new TestName
{
FullName = fullName,
Name = splitted.Length > 0 ? splitted[splitted.Length - 1] : string.Empty
},
Categories = categories,
IsSuite = type != TestType.TestMethod,
TestCount = type == TestType.TestMethod ? 1 : RandomValuesGenerator.GetRandomValue<int>(),
TestType = type.ToString()
})
{
AssertCount = 1,
Time = RandomValuesGenerator.GetRandomValue<double>()
};
if (state != ResultState.Success)
testResult.SetResult(state,
description,
stackTrace);
else
testResult.Success(description);
testResult.SetAgentName(agentName);
foreach (var childResult in childResults)
{
testResult.AddResult(childResult);
}
return testResult;
}
示例3: BuildTest
private void BuildTest(string file, TestType type)
{
// Build the csproj.
bool isBuildDone = false;
int attempts = 0;
string output = string.Empty;
string msbuildexe = FindLatestMsbuildVersion() + "MSBuild.exe";
// Attempting building upto three times.
while (!isBuildDone && attempts++ < 3)
{
Console.Write("\tBuilding the " + type.ToString().ToLower() + " test..");
ProcessStartInfo psi = new ProcessStartInfo(msbuildexe, "\"" + file + "\"");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
Process proc = System.Diagnostics.Process.Start(psi);
output = proc.StandardOutput.ReadToEnd();
isBuildDone = proc.WaitForExit(60000);
if (isBuildDone && proc.ExitCode == 0)
{
Console.WriteLine(" built successfully");
return;
}
else
{
isBuildDone = false;
Console.WriteLine(" build failure.. retrying..");
}
}
if (!isBuildDone)
{
Console.WriteLine(" BUILD FAILURE.. quitting..");
throw new ApplicationException("\r\nBUILD FAILURE: \r\n" + output + "\r\n File: \r\n" + file);
}
}