-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
249c287
commit 5594c56
Showing
10 changed files
with
712 additions
and
712 deletions.
There are no files selected for viewing
72 changes: 36 additions & 36 deletions
72
source/Octopus.Cli.Tests/Commands/CreateReleaseCommandFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
using NSubstitute; | ||
using NUnit.Framework; | ||
using Octopus.Cli.Commands; | ||
using Octopus.Cli.Infrastructure; | ||
using Octopus.Cli.Tests.Helpers; | ||
using Octopus.Cli.Util; | ||
|
||
namespace Octopus.Cli.Tests.Commands | ||
{ | ||
public class CreateReleaseCommandFixture : ApiCommandFixtureBase | ||
{ | ||
CreateReleaseCommand createReleaseCommand; | ||
IPackageVersionResolver versionResolver; | ||
IReleasePlanBuilder releasePlanBuilder; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
versionResolver = Substitute.For<IPackageVersionResolver>(); | ||
releasePlanBuilder = Substitute.For<IReleasePlanBuilder>(); | ||
} | ||
|
||
[Test] | ||
public void ShouldLoadOptionsFromFile() | ||
{ | ||
createReleaseCommand = new CreateReleaseCommand(RepositoryFactory, Log, new OctopusPhysicalFileSystem(Log), versionResolver, releasePlanBuilder); | ||
|
||
Assert.Throws<CouldNotFindException>(delegate { | ||
createReleaseCommand.Execute("--configfile=Commands/Resources/CreateRelease.config.txt"); | ||
}); | ||
|
||
Assert.AreEqual("Test Project", createReleaseCommand.ProjectName); | ||
Assert.AreEqual("1.0.0", createReleaseCommand.VersionNumber); | ||
Assert.AreEqual("Test config file.", createReleaseCommand.ReleaseNotes); | ||
} | ||
} | ||
using NSubstitute; | ||
using NUnit.Framework; | ||
using Octopus.Cli.Commands; | ||
using Octopus.Cli.Infrastructure; | ||
using Octopus.Cli.Tests.Helpers; | ||
using Octopus.Cli.Util; | ||
|
||
namespace Octopus.Cli.Tests.Commands | ||
{ | ||
public class CreateReleaseCommandFixture : ApiCommandFixtureBase | ||
{ | ||
CreateReleaseCommand createReleaseCommand; | ||
IPackageVersionResolver versionResolver; | ||
IReleasePlanBuilder releasePlanBuilder; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
versionResolver = Substitute.For<IPackageVersionResolver>(); | ||
releasePlanBuilder = Substitute.For<IReleasePlanBuilder>(); | ||
} | ||
|
||
[Test] | ||
public void ShouldLoadOptionsFromFile() | ||
{ | ||
createReleaseCommand = new CreateReleaseCommand(RepositoryFactory, Log, new OctopusPhysicalFileSystem(Log), versionResolver, releasePlanBuilder); | ||
|
||
Assert.Throws<CouldNotFindException>(delegate { | ||
createReleaseCommand.Execute("--configfile=Commands/Resources/CreateRelease.config.txt"); | ||
}); | ||
|
||
Assert.AreEqual("Test Project", createReleaseCommand.ProjectName); | ||
Assert.AreEqual("1.0.0", createReleaseCommand.VersionNumber); | ||
Assert.AreEqual("Test config file.", createReleaseCommand.ReleaseNotes); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,126 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{B05E3858-5607-46DB-876C-4E1F5728A4BB}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Octopus.Cli.Tests</RootNamespace> | ||
<AssemblyName>Octopus.Cli.Tests</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> | ||
<RestorePackages>true</RestorePackages> | ||
<TargetFrameworkProfile /> | ||
<NuGetPackageImportStamp> | ||
</NuGetPackageImportStamp> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<Prefer32Bit>false</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<Prefer32Bit>false</Prefer32Bit> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="log4net"> | ||
<HintPath>..\packages\log4net.2.0.2\lib\net40-full\log4net.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net40\Newtonsoft.Json.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="nunit.framework"> | ||
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Octopus.Client, Version=3.3.9.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Octopus.Client.3.3.9\lib\net40\Octopus.Client.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Net" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="NSubstitute"> | ||
<HintPath>..\packages\NSubstitute.1.7.2.0\lib\NET40\NSubstitute.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="..\Solution Items\SolutionInfo.cs"> | ||
<Link>Properties\SolutionInfo.cs</Link> | ||
</Compile> | ||
<Compile Include="..\Solution Items\VersionInfo.cs"> | ||
<Link>Properties\VersionInfo.cs</Link> | ||
</Compile> | ||
<Compile Include="Client\OctopusSessionFactoryFixture.cs" /> | ||
<Compile Include="Commands\ApiCommandFixture.cs" /> | ||
<Compile Include="Commands\ApiCommandFixtureBase.cs" /> | ||
<Compile Include="Commands\CleanEnvironmentCommandFixture.cs" /> | ||
<Compile Include="Commands\CreateChannelCommandFixture.cs" /> | ||
<Compile Include="Commands\DeployReleaseCommandTestFixture.cs" /> | ||
<Compile Include="Commands\DummyApiCommand.cs" /> | ||
<Compile Include="Commands\ListMachinesCommandFixture.cs" /> | ||
<Compile Include="Commands\ListEnvironmentsCommandFixture.cs" /> | ||
<Compile Include="Commands\ListProjectsCommandFixture.cs" /> | ||
<Compile Include="Commands\ListReleasesCommandFixture.cs" /> | ||
<Compile Include="Commands\PackageVersionResolverFixture.cs" /> | ||
<Compile Include="Commands\HelpCommandFixture.cs" /> | ||
<Compile Include="Commands\OptionsFixture.cs" /> | ||
<Compile Include="Commands\CreateReleaseCommandFixture.cs" /> | ||
<Compile Include="Commands\SpeakCommand.cs" /> | ||
<Compile Include="Extensions\TimeSpanExtensionsFixture.cs" /> | ||
<Compile Include="Helpers\TestCommandExtensions.cs" /> | ||
<Compile Include="Util\UriExtensionsFixture.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Octopus.Cli\Octopus.Cli.csproj"> | ||
<Project>{D1BFD88F-FB8E-49EC-968F-F4D9A8A52519}</Project> | ||
<Name>OctopusTools</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="app.config" /> | ||
<Content Include="Commands\Resources\CreateRelease.config.txt"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Import Project="..\packages\GitVersionTask.3.3.0\build\dotnet\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.3.3.0\build\dotnet\GitVersionTask.targets')" /> | ||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
<PropertyGroup> | ||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
</PropertyGroup> | ||
<Error Condition="!Exists('..\packages\GitVersionTask.3.3.0\build\dotnet\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.3.3.0\build\dotnet\GitVersionTask.targets'))" /> | ||
</Target> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{B05E3858-5607-46DB-876C-4E1F5728A4BB}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Octopus.Cli.Tests</RootNamespace> | ||
<AssemblyName>Octopus.Cli.Tests</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> | ||
<RestorePackages>true</RestorePackages> | ||
<TargetFrameworkProfile /> | ||
<NuGetPackageImportStamp> | ||
</NuGetPackageImportStamp> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<Prefer32Bit>false</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<Prefer32Bit>false</Prefer32Bit> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="log4net"> | ||
<HintPath>..\packages\log4net.2.0.2\lib\net40-full\log4net.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net40\Newtonsoft.Json.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="nunit.framework"> | ||
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Octopus.Client, Version=3.3.9.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Octopus.Client.3.3.9\lib\net40\Octopus.Client.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Net" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="NSubstitute"> | ||
<HintPath>..\packages\NSubstitute.1.7.2.0\lib\NET40\NSubstitute.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="..\Solution Items\SolutionInfo.cs"> | ||
<Link>Properties\SolutionInfo.cs</Link> | ||
</Compile> | ||
<Compile Include="..\Solution Items\VersionInfo.cs"> | ||
<Link>Properties\VersionInfo.cs</Link> | ||
</Compile> | ||
<Compile Include="Client\OctopusSessionFactoryFixture.cs" /> | ||
<Compile Include="Commands\ApiCommandFixture.cs" /> | ||
<Compile Include="Commands\ApiCommandFixtureBase.cs" /> | ||
<Compile Include="Commands\CleanEnvironmentCommandFixture.cs" /> | ||
<Compile Include="Commands\CreateChannelCommandFixture.cs" /> | ||
<Compile Include="Commands\DeployReleaseCommandTestFixture.cs" /> | ||
<Compile Include="Commands\DummyApiCommand.cs" /> | ||
<Compile Include="Commands\ListMachinesCommandFixture.cs" /> | ||
<Compile Include="Commands\ListEnvironmentsCommandFixture.cs" /> | ||
<Compile Include="Commands\ListProjectsCommandFixture.cs" /> | ||
<Compile Include="Commands\ListReleasesCommandFixture.cs" /> | ||
<Compile Include="Commands\PackageVersionResolverFixture.cs" /> | ||
<Compile Include="Commands\HelpCommandFixture.cs" /> | ||
<Compile Include="Commands\OptionsFixture.cs" /> | ||
<Compile Include="Commands\CreateReleaseCommandFixture.cs" /> | ||
<Compile Include="Commands\SpeakCommand.cs" /> | ||
<Compile Include="Extensions\TimeSpanExtensionsFixture.cs" /> | ||
<Compile Include="Helpers\TestCommandExtensions.cs" /> | ||
<Compile Include="Util\UriExtensionsFixture.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Octopus.Cli\Octopus.Cli.csproj"> | ||
<Project>{D1BFD88F-FB8E-49EC-968F-F4D9A8A52519}</Project> | ||
<Name>OctopusTools</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="app.config" /> | ||
<Content Include="Commands\Resources\CreateRelease.config.txt"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Import Project="..\packages\GitVersionTask.3.3.0\build\dotnet\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.3.3.0\build\dotnet\GitVersionTask.targets')" /> | ||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
<PropertyGroup> | ||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
</PropertyGroup> | ||
<Error Condition="!Exists('..\packages\GitVersionTask.3.3.0\build\dotnet\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.3.3.0\build\dotnet\GitVersionTask.targets'))" /> | ||
</Target> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
using Octopus.Cli.Model; | ||
using Octopus.Client; | ||
using Octopus.Client.Model; | ||
|
||
namespace Octopus.Cli.Commands | ||
{ | ||
public class ChannelVersionRuleTester : IChannelVersionRuleTester | ||
{ | ||
public ChannelVersionRuleTestResult Test(IOctopusRepository repository, ChannelVersionRuleResource rule, string packageVersion) | ||
{ | ||
var link = repository.Client.RootDocument.Link("VersionRuleTest"); | ||
var response = repository.Client.Get<ChannelVersionRuleTestResult>(link, new | ||
{ | ||
version = packageVersion, | ||
versionRange = rule.VersionRange, | ||
preReleaseTag = rule.Tag | ||
}); | ||
|
||
return response; | ||
} | ||
} | ||
} | ||
using Octopus.Cli.Model; | ||
using Octopus.Client; | ||
using Octopus.Client.Model; | ||
|
||
namespace Octopus.Cli.Commands | ||
{ | ||
public class ChannelVersionRuleTester : IChannelVersionRuleTester | ||
{ | ||
public ChannelVersionRuleTestResult Test(IOctopusRepository repository, ChannelVersionRuleResource rule, string packageVersion) | ||
{ | ||
var link = repository.Client.RootDocument.Link("VersionRuleTest"); | ||
var response = repository.Client.Get<ChannelVersionRuleTestResult>(link, new | ||
{ | ||
version = packageVersion, | ||
versionRange = rule.VersionRange, | ||
preReleaseTag = rule.Tag | ||
}); | ||
|
||
return response; | ||
} | ||
} | ||
} |
Oops, something went wrong.