本文整理汇总了C#中Fixture.NewNuGetExecutor方法的典型用法代码示例。如果您正苦于以下问题:C# Fixture.NewNuGetExecutor方法的具体用法?C# Fixture.NewNuGetExecutor怎么用?C# Fixture.NewNuGetExecutor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fixture
的用法示例。
在下文中一共展示了Fixture.NewNuGetExecutor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartPacking_should_create_nupkg
public void StartPacking_should_create_nupkg()
{
// Arrange
var fixture = new Fixture().Customize(new AutoMoqCustomization());
{
var m = new Mock<IEnvironmentRepository>(MockBehavior.Strict);
m.Setup(_ => _.GetNuGetPath()).Returns(AppDomain.CurrentDomain.GetPathInBaseDirectory(@"tools\NuGet.exe"));
fixture.Inject(m);
}
var nugetExecutor = fixture.NewNuGetExecutor();
// Act
var result = nugetExecutor.StartPacking(AppDomain.CurrentDomain.GetPathInBaseDirectory(@"tools\NuGet\Prig.nuspec"), AppDomain.CurrentDomain.BaseDirectory);
// Assert
var lines = result.Split(new[] { "\r\n" }, StringSplitOptions.None);
Assert.LessOrEqual(2, lines.Length);
var match = Regex.Match(lines[1], "'([^']+)'");
Assert.IsTrue(match.Success);
var nupkgPath = match.Groups[1].Value;
Assert.IsTrue(File.Exists(nupkgPath));
Assert.GreaterOrEqual(TimeSpan.FromSeconds(1), DateTime.Now - File.GetLastWriteTime(nupkgPath));
}
示例2: StartSourcing_should_add_the_specified_source_if_it_has_not_existed_yet
public void StartSourcing_should_add_the_specified_source_if_it_has_not_existed_yet()
{
using (var nugetConfig = new FileInfo(Path.Combine(Environment.ExpandEnvironmentVariables("%APPDATA%"), @"NuGet\NuGet.Config")).BeginModifying())
{
// Arrange
nugetConfig.Info.Delete();
var fixture = new Fixture().Customize(new AutoMoqCustomization());
{
var m = new Mock<IEnvironmentRepository>(MockBehavior.Strict);
m.Setup(_ => _.GetNuGetPath()).Returns(AppDomain.CurrentDomain.GetPathInBaseDirectory(@"tools\NuGet.exe"));
fixture.Inject(m);
}
var nugetExecutor = fixture.NewNuGetExecutor();
// Act
var result = nugetExecutor.StartSourcing("Prig Source", AppDomain.CurrentDomain.BaseDirectory);
// Assert
Assert.That(result, Is.StringMatching("Prig Source"));
}
}
示例3: StartSourcing_should_update_the_specified_source_if_only_letter_case_is_unmatched
public void StartSourcing_should_update_the_specified_source_if_only_letter_case_is_unmatched()
{
using (var nugetConfig = new FileInfo(Path.Combine(Environment.ExpandEnvironmentVariables("%APPDATA%"), @"NuGet\NuGet.Config")).BeginModifying())
{
// Arrange
var xml = @"<?xml version=""1.0"" encoding=""utf-8""?>
<configuration>
<packageSources>
<add key=""https://www.nuget.org/api/v2/"" value=""https://www.nuget.org/api/v2/"" />
<add key=""pRiG sOurCe"" value=""C:\Users\Akira\Prig\Test.Urasandesu.Prig.VSPackage\bin\Debug\ "" />
</packageSources>
<disabledPackageSources />
</configuration>
";
using (var fs = nugetConfig.Info.Open(FileMode.Create))
using (var sw = new StreamWriter(fs))
sw.Write(xml);
var fixture = new Fixture().Customize(new AutoMoqCustomization());
{
var m = new Mock<IEnvironmentRepository>(MockBehavior.Strict);
m.Setup(_ => _.GetNuGetPath()).Returns(AppDomain.CurrentDomain.GetPathInBaseDirectory(@"tools\NuGet.exe"));
fixture.Inject(m);
}
var nugetExecutor = fixture.NewNuGetExecutor();
// Act
var result = nugetExecutor.StartSourcing("Prig Source", Environment.ExpandEnvironmentVariables("%TEMP%"));
// Assert
Assert.That(result, Is.StringMatching("Prig Source"));
}
}
示例4: StartUnsourcing_should_do_nothing_if_package_name_matches_partially
public void StartUnsourcing_should_do_nothing_if_package_name_matches_partially()
{
using (var nugetConfig = new FileInfo(Path.Combine(Environment.ExpandEnvironmentVariables("%APPDATA%"), @"NuGet\NuGet.Config")).BeginModifying())
{
// Arrange
var xml = @"<?xml version=""1.0"" encoding=""utf-8""?>
<configuration>
<packageSources>
<add key=""https://www.nuget.org/api/v2/"" value=""https://www.nuget.org/api/v2/"" />
<add key=""Moq.Prig Source"" value=""C:\ProgramData\chocolatey\lib\Moq.Prig\tools"" />
</packageSources>
<disabledPackageSources />
</configuration>
";
using (var fs = nugetConfig.Info.Open(FileMode.Create))
using (var sw = new StreamWriter(fs))
sw.Write(xml);
var fixture = new Fixture().Customize(new AutoMoqCustomization());
{
var m = new Mock<IEnvironmentRepository>(MockBehavior.Strict);
m.Setup(_ => _.GetNuGetPath()).Returns(AppDomain.CurrentDomain.GetPathInBaseDirectory(@"tools\NuGet.exe"));
fixture.Inject(m);
}
var nugetExecutor = fixture.NewNuGetExecutor();
// Act
var result = nugetExecutor.StartUnsourcing("Prig Source");
// Assert
Assert.That(result, Is.StringMatching("Prig Source"));
}
}