Skip to content

Commit

Permalink
Moved tool fixture to Cake.Testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrik Svensson committed Dec 30, 2015
1 parent 4b968b3 commit 4960b98
Show file tree
Hide file tree
Showing 98 changed files with 696 additions and 507 deletions.
4 changes: 0 additions & 4 deletions src/Cake.Common.Tests/Cake.Common.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,6 @@
<Project>{8074B833-11B8-459F-BB98-BFBA2BC5C698}</Project>
<Name>Cake.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Cake.Testing.Shared\Cake.Testing.Shared.csproj">
<Project>{8e5a518a-eb84-4a1b-a091-d9d66c8ff979}</Project>
<Name>Cake.Testing.Shared</Name>
</ProjectReference>
<ProjectReference Include="..\Cake.Testing.Xunit\Cake.Testing.Xunit.csproj">
<Project>{5AF751D1-BB54-4268-9E42-3A898B034B06}</Project>
<Name>Cake.Testing.Xunit</Name>
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Common.Tests/Fixtures/Tools/CakeRunnerFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Cake.Core;
using Cake.Core.IO;
using Cake.Testing;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;
using NSubstitute;

namespace Cake.Common.Tests.Fixtures.Tools
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Common.Tests/Fixtures/Tools/CandleFixture.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Cake.Common.Tools.WiX;
using Cake.Core.IO;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
using Cake.Core.Diagnostics;
using Cake.Core.IO;
using Cake.Core.Tooling;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;
using NSubstitute;

namespace Cake.Common.Tests.Fixtures.Tools.Chocolatey
{
internal abstract class ChocolateyFixture<TSettings> : ChocolateyFixture<TSettings, ToolFixtureResult>
where TSettings : ToolSettings, new()
{
protected override ToolFixtureResult CreateResult(FilePath toolPath, ProcessSettings process)
protected override ToolFixtureResult CreateResult(FilePath path, ProcessSettings process)
{
return new ToolFixtureResult(toolPath, process);
return new ToolFixtureResult(path, process);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public void GivenTemporaryNuSpecAlreadyExist()
FileSystem.CreateFile("/Working/existing.temp.nuspec");
}

protected override ChocolateyPackerFixtureResult CreateResult(FilePath toolPath, ProcessSettings process)
protected override ChocolateyPackerFixtureResult CreateResult(FilePath path, ProcessSettings process)
{
return new ChocolateyPackerFixtureResult(FileSystem, toolPath, process);
return new ChocolateyPackerFixtureResult(FileSystem, path, process);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Cake.Core;
using Cake.Core.IO;
using Cake.Testing;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools.Chocolatey.Packer
{
Expand All @@ -16,8 +16,8 @@ public string NuspecContent
get { return _nuspecContent; }
}

public ChocolateyPackerFixtureResult(FakeFileSystem fileSystem, FilePath toolPath, ProcessSettings process)
: base(toolPath, process)
public ChocolateyPackerFixtureResult(FakeFileSystem fileSystem, FilePath path, ProcessSettings process)
: base(path, process)
{
_nuspecContent = GetNuSpecContent(fileSystem, process);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Cake.Common.Tests/Fixtures/Tools/DNU/DNUFixture.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using Cake.Core.IO;
using Cake.Core.Tooling;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;
using NSubstitute;

namespace Cake.Common.Tests.Fixtures.Tools.DNU
{
internal abstract class DNUFixture<TSettings> : DNUFixture<TSettings, ToolFixtureResult>
where TSettings : ToolSettings, new()
{
protected override ToolFixtureResult CreateResult(FilePath toolPath, ProcessSettings process)
protected override ToolFixtureResult CreateResult(FilePath path, ProcessSettings process)
{
return new ToolFixtureResult(toolPath, process);
return new ToolFixtureResult(path, process);
}
}

Expand All @@ -21,7 +21,7 @@ internal abstract class DNUFixture<TSettings, TFixtureResult> : ToolFixture<TSet
protected DNUFixture()
: base("dnu.cmd")
{
Process.GetStandardOutput().Returns(new string[] { });
ProcessRunner.Process.SetStandardOutput(new string[] { });
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Cake.Common.Tools.DupFinder;
using Cake.Core.Diagnostics;
using Cake.Core.IO;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;
using NSubstitute;

namespace Cake.Common.Tests.Fixtures.Tools.DupFinder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Cake.Core.Diagnostics;
using Cake.Core.IO;
using Cake.Testing;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;
using NSubstitute;

namespace Cake.Common.Tests.Fixtures.Tools.DupFinder
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Common.Tests/Fixtures/Tools/FixieRunnerFixture.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Cake.Common.Tools.Fixie;
using Cake.Core.IO;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Cake.Common.Tools.GitReleaseManager;
using Cake.Core.Diagnostics;
using Cake.Core.Tooling;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;
using NSubstitute;

namespace Cake.Common.Tests.Fixtures.Tools
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Cake.Common.Tools.GitReleaseNotes;
using Cake.Core.IO;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Cake.Core.Diagnostics;
using NSubstitute;
using System.Runtime.Serialization.Json;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools
{
Expand Down Expand Up @@ -34,7 +34,7 @@ public GitVersionRunnerFixture()
output.Add(reader.ReadLine());
}

Process.GetStandardOutput().Returns(output);
ProcessRunner.Process.SetStandardOutput(output);
}

Log = Substitute.For<ICakeLog>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Cake.Common.Tools.ILMerge;
using Cake.Core.IO;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Cake.Common.Tools.InspectCode;
using Cake.Core.IO;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools.InspectCode
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Cake.Common.Tools.MSBuild;
using Cake.Core.IO;
using Cake.Testing;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools
{
Expand Down
4 changes: 2 additions & 2 deletions src/Cake.Common.Tests/Fixtures/Tools/MSTestRunnerFixture.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Cake.Common.Tools.MSTest;
using Cake.Core.IO;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools
{
Expand All @@ -15,7 +15,7 @@ public MSTestRunnerFixture()
Environment.SetSpecialPath(SpecialPath.ProgramFilesX86, "/ProgramFilesX86");
}

protected override FilePath GetDefaultToolPath()
protected override FilePath GetDefaultToolPath(string toolFilename)
{
return new FilePath("/ProgramFilesX86/Microsoft Visual Studio 12.0/Common7/IDE/mstest.exe");
}
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Common.Tests/Fixtures/Tools/NSISFixture.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Cake.Common.Tools.NSIS;
using Cake.Core.IO;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Cake.Common.Tools.NUnit;
using Cake.Core.IO;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Common.Tests/Fixtures/Tools/NUnitRunnerFixture.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Cake.Common.Tools.NUnit;
using Cake.Core.IO;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools
{
Expand Down
9 changes: 4 additions & 5 deletions src/Cake.Common.Tests/Fixtures/Tools/NuGet/NuGetFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
using Cake.Core.IO;
using Cake.Core.IO.NuGet;
using Cake.Core.Tooling;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;
using NSubstitute;

namespace Cake.Common.Tests.Fixtures.Tools.NuGet
{
internal abstract class NuGetFixture<TSettings> : NuGetFixture<TSettings, ToolFixtureResult>
where TSettings : ToolSettings, new()
{
protected override ToolFixtureResult CreateResult(FilePath toolPath, ProcessSettings process)
protected override ToolFixtureResult CreateResult(FilePath path, ProcessSettings process)
{
return new ToolFixtureResult(toolPath, process);
return new ToolFixtureResult(path, process);
}
}

Expand All @@ -26,8 +26,7 @@ internal abstract class NuGetFixture<TSettings, TFixtureResult> : ToolFixture<TS
protected NuGetFixture()
: base("NuGet.exe")
{
Process.GetStandardOutput().Returns(new string[] { });

ProcessRunner.Process.SetStandardOutput(new string[] { });
Resolver = Substitute.For<INuGetToolResolver>();
Log = Substitute.For<ICakeLog>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public void GivenTemporaryNuSpecAlreadyExist()
FileSystem.CreateFile("/Working/existing.temp.nuspec");
}

protected override NuGetPackerFixtureResult CreateResult(FilePath toolPath, ProcessSettings process)
protected override NuGetPackerFixtureResult CreateResult(FilePath path, ProcessSettings process)
{
return new NuGetPackerFixtureResult(FileSystem, toolPath, process);
return new NuGetPackerFixtureResult(FileSystem, path, process);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Cake.Core;
using Cake.Core.IO;
using Cake.Testing;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools.NuGet.Packer
{
Expand All @@ -16,8 +16,8 @@ public string NuspecContent
get { return _nuspecContent; }
}

public NuGetPackerFixtureResult(FakeFileSystem fileSystem, FilePath toolPath, ProcessSettings process)
: base(toolPath, process)
public NuGetPackerFixtureResult(FakeFileSystem fileSystem, FilePath path, ProcessSettings process)
: base(path, process)
{
_nuspecContent = GetNuSpecContent(fileSystem, process);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ public NuGetSetApiKeyFixture()
Source = "http://a.com";

// Set the standard output.
Process.GetStandardOutput()
.Returns(new[] { string.Concat("The API Key '", ApiKey, "' was saved for '", Source, "'.") });
ProcessRunner.Process.SetStandardOutput(new[] {
string.Concat("The API Key '", ApiKey,
"' was saved for '", Source, "'.")});
}

public void GivenUnexpectedOutput()
{
Process.GetStandardOutput().Returns(new string[] { });
ProcessRunner.Process.SetStandardOutput(new string[] { });
}

protected override void RunTool()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public NuGetSetProxyFixture()

public void GivenUnexpectedOutput()
{
Process.GetStandardOutput().Returns(new[] { "Unknown Command" });
ProcessRunner.Process.SetStandardOutput(new[] { "Unknown Command" });
}

protected override void RunTool()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@ protected NuGetSourcesFixture()

public void GivenExistingSource()
{
Process.GetStandardOutput()
.Returns(new[] {
" 1. https://www.nuget.org/api/v2/ [Enabled]",
" https://www.nuget.org/api/v2/",
string.Format(" 2. {0} [Enabled]", Name),
string.Format(" {0}", Source)
});
ProcessRunner.Process.SetStandardOutput(new[] {
" 1. https://www.nuget.org/api/v2/ [Enabled]",
" https://www.nuget.org/api/v2/",
string.Format(" 2. {0} [Enabled]", Name),
string.Format(" {0}", Source)});
}

public void GivenSourceAlreadyHasBeenAdded()
{
Process.GetStandardOutput().Returns(new[] { Source });
ProcessRunner.Process.SetStandardOutput(new[] { Source });
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Cake.Common.Tools.OctopusDeploy;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Common.Tests/Fixtures/Tools/OpenCoverFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Cake.Core;
using Cake.Core.Diagnostics;
using Cake.Core.IO;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;
using NSubstitute;

namespace Cake.Common.Tests.Fixtures.Tools
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Cake.Common.Tools.ReportGenerator;
using Cake.Core.IO;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Cake.Common.Tools.ReportUnit;
using Cake.Core.IO;
using Cake.Testing.Shared;
using Cake.Testing.Fixtures;

namespace Cake.Common.Tests.Fixtures.Tools.ReportUnit
{
Expand Down

0 comments on commit 4960b98

Please sign in to comment.