本文整理汇总了C#中Testable_xunit.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# Testable_xunit.Execute方法的具体用法?C# Testable_xunit.Execute怎么用?C# Testable_xunit.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Testable_xunit
的用法示例。
在下文中一共展示了Testable_xunit.Execute方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LogsWelcomeBanner
public static void LogsWelcomeBanner()
{
var xunit = new Testable_xunit();
xunit.Execute();
xunit.BuildEngine.Received().LogMessageEvent(Arg.Is<BuildMessageEventArgs>(bmea => ValidateWelcomeBanner(bmea)));
}
示例2: ReturnsFalseWhenExitCodeIsNonZero
public static void ReturnsFalseWhenExitCodeIsNonZero()
{
var xunit = new Testable_xunit(exitCode: 1);
var result = xunit.Execute();
Assert.False(result);
}
示例3: ReturnsTrueWhenExitCodeIsZeroAndFailCountIsZero
public static void ReturnsTrueWhenExitCodeIsZeroAndFailCountIsZero()
{
var xunit = new Testable_xunit(exitCode: 0);
var result = xunit.Execute();
Assert.True(result);
}
示例4: DoesNotChangeCurrentDirectoryWhenWorkingFolderIsNull
public static void DoesNotChangeCurrentDirectoryWhenWorkingFolderIsNull()
{
var currentFolder = Directory.GetCurrentDirectory();
var xunit = new Testable_xunit();
xunit.Execute();
Assert.Equal(currentFolder, Directory.GetCurrentDirectory());
}
示例5: ChangesCurrentDirectoryWhenWorkingFolderIsNotNull
public void ChangesCurrentDirectoryWhenWorkingFolderIsNotNull()
{
var tempFolder = Environment.GetEnvironmentVariable("TEMP");
var xunit = new Testable_xunit { WorkingFolder = tempFolder };
xunit.Execute();
Assert.Equal(tempFolder, Directory.GetCurrentDirectory());
}
示例6: ChangesCurrentDirectoryWhenWorkingFolderIsNotNull
public static void ChangesCurrentDirectoryWhenWorkingFolderIsNotNull()
{
var tempFolder = Environment.GetEnvironmentVariable("TEMP");
tempFolder = Path.GetFullPath(tempFolder); // Ensure that the 8.3 path is not used
var xunit = new Testable_xunit { WorkingFolder = tempFolder };
xunit.Execute();
Assert.Equal(tempFolder, Directory.GetCurrentDirectory());
}
示例7: LogsWelcomeBanner
public static void LogsWelcomeBanner()
{
var xunit = new Testable_xunit();
xunit.Execute();
var eventArgs = Assert.IsType<BuildMessageEventArgs>(xunit.BuildEngine.Captured(x => x.LogMessageEvent(null)).Args().Single());
Assert.Equal(string.Format("xUnit.net MSBuild Runner ({0}-bit .NET {1})", IntPtr.Size * 8, Environment.Version), eventArgs.Message);
Assert.Equal(MessageImportance.High, eventArgs.Importance);
}
示例8: CallsExecuteAssemblyOnceForEachAssembly
public void CallsExecuteAssemblyOnceForEachAssembly()
{
var visitor = new XmlTestExecutionVisitor(null, null);
visitor.Finished.Set();
var assm1 = new TaskItem(@"C:\Full\Path\1");
var assm2 = new TaskItem(@"C:\Full\Path\2", new Dictionary<string, string> { { "ConfigFile", @"C:\Config\File" } });
var xunit = new Testable_xunit { CreateVisitor_Result = visitor };
xunit.Assemblies = new ITaskItem[] { assm1, assm2 };
xunit.Execute();
Assert.Collection(xunit.ExecuteAssembly_Calls,
call => Assert.Equal(@"C:\Full\Path\1, (null)", call),
call => Assert.Equal(@"C:\Full\Path\2, C:\Config\File", call)
);
}
示例9: ChangesCurrentDirectoryWhenWorkingFolderIsNotNull
public static void ChangesCurrentDirectoryWhenWorkingFolderIsNotNull()
{
var tempFolder = Environment.GetEnvironmentVariable("TEMP");
tempFolder = Path.GetFullPath(tempFolder); // Ensure that the 8.3 path is not used
var xunit = new Testable_xunit { WorkingFolder = tempFolder };
xunit.Execute();
string actual = Directory.GetCurrentDirectory();
string expected = tempFolder;
if (actual[actual.Length - 1] != Path.DirectorySeparatorChar)
{
actual += Path.DirectorySeparatorChar;
}
if (expected[expected.Length - 1] != Path.DirectorySeparatorChar)
{
expected += Path.DirectorySeparatorChar;
}
Assert.Equal(expected, actual);
}
示例10: WritesHtmlToDisk
public static void WritesHtmlToDisk()
{
var tempFile = Path.GetTempFileName();
File.Delete(tempFile);
try
{
var visitor = new XmlTestExecutionVisitor(null, null) { Failed = 1 };
visitor.Finished.Set();
var task = Substitute.For<ITaskItem>();
task.GetMetadata("FullPath").Returns("C:\\Full\\Path\\Name.dll");
var htmlTaskItem = Substitute.For<ITaskItem>();
htmlTaskItem.GetMetadata("FullPath").Returns(tempFile);
var xunit = new Testable_xunit { CreateVisitor_Result = visitor, Assemblies = new[] { task }, Html = htmlTaskItem };
xunit.Execute();
Assert.True(File.Exists(tempFile));
}
finally
{
File.Delete(tempFile);
}
}
示例11: WritesXmlV1ToDisk
public static void WritesXmlV1ToDisk()
{
var tempFile = Path.GetTempFileName();
try
{
var visitor = new XmlTestExecutionVisitor(null, null) { Failed = 1 };
visitor.Finished.Set();
var task = Substitute.For<ITaskItem>();
task.GetMetadata("FullPath").Returns("C:\\Full\\Path\\Name.dll");
var xmlTaskItem = Substitute.For<ITaskItem>();
xmlTaskItem.GetMetadata("FullPath").Returns(tempFile);
var xunit = new Testable_xunit { CreateVisitor_Result = visitor, Assemblies = new[] { task }, XmlV1 = xmlTaskItem };
xunit.Execute();
new XmlDocument().Load(tempFile); // File should exist as legal XML
}
finally
{
File.Delete(tempFile);
}
}
示例12: ReturnsFalseWhenFailCountIsNonZero
public static void ReturnsFalseWhenFailCountIsNonZero()
{
var visitor = new XmlTestExecutionVisitor(null, null) { Failed = 1 };
visitor.Finished.Set();
var task = Substitute.For<ITaskItem>();
task.GetMetadata("FullPath").Returns("C:\\Full\\Path\\Name.dll");
var xunit = new Testable_xunit { CreateVisitor_Result = visitor, Assemblies = new[] { task } };
xunit.DiscoveryTestCases.Add(Mocks.TestCase());
var result = xunit.Execute();
Assert.False(result);
}
示例13: WritesXmlToDisk
public void WritesXmlToDisk()
{
var tempFile = Path.GetTempFileName();
try
{
var visitor = new MSBuildVisitor(null, null, null) { Failed = 1 };
visitor.Finished.Set();
var task = Substitute.For<ITaskItem>();
task.GetMetadata("FullPath").Returns("C:\\Full\\Path\\Name.dll");
var xmlTaskItem = Substitute.For<ITaskItem>();
xmlTaskItem.GetMetadata("FullPath").Returns(tempFile);
var xunit = new Testable_xunit { CreateVisitor_Result = visitor, Assemblies = new[] { task }, Xml = xmlTaskItem };
xunit.Execute();
Assert.DoesNotThrow(() => new XmlDocument().Load(tempFile));
}
finally
{
File.Delete(tempFile);
}
}
示例14: StopsExecutingAssemblyWhenCanceled
public void StopsExecutingAssemblyWhenCanceled()
{
var assembly = new TaskItem(@"C:\Full\Path\1");
var xunit = new Testable_xunit { Assemblies = new ITaskItem[] { assembly } };
xunit.Cancel();
xunit.Execute();
Assert.Empty(xunit.ExecuteAssembly_Calls);
}