-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding tests for SpecificVersion attribute
- Loading branch information
Showing
8 changed files
with
323 additions
and
7 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -0,0 +1,236 @@ | ||
module Paket.InstallModel.Xml.ControlzEx | ||
|
||
open FsUnit | ||
open NUnit.Framework | ||
open Paket | ||
open Paket.Requirements | ||
open Paket.Domain | ||
open Paket.TestHelpers | ||
|
||
let expectedWithoutSpecificVersion = """ | ||
<Choose xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.0.3')"> | ||
<ItemGroup> | ||
<Reference Include="ControlzEx"> | ||
<HintPath>..\..\..\ControlzEx\lib\net40\ControlzEx.dll</HintPath> | ||
<Private>True</Private> | ||
<Paket>True</Paket> | ||
</Reference> | ||
<Reference Include="System.Windows.Interactivity"> | ||
<HintPath>..\..\..\ControlzEx\lib\net40\System.Windows.Interactivity.dll</HintPath> | ||
<Private>True</Private> | ||
<Paket>True</Paket> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')"> | ||
<ItemGroup> | ||
<Reference Include="ControlzEx"> | ||
<HintPath>..\..\..\ControlzEx\lib\net45\ControlzEx.dll</HintPath> | ||
<Private>True</Private> | ||
<Paket>True</Paket> | ||
</Reference> | ||
<Reference Include="System.Windows.Interactivity"> | ||
<HintPath>..\..\..\ControlzEx\lib\net45\System.Windows.Interactivity.dll</HintPath> | ||
<Private>True</Private> | ||
<Paket>True</Paket> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')"> | ||
<ItemGroup> | ||
<Reference Include="ControlzEx"> | ||
<HintPath>..\..\..\ControlzEx\lib\net462\ControlzEx.dll</HintPath> | ||
<Private>True</Private> | ||
<Paket>True</Paket> | ||
</Reference> | ||
<Reference Include="System.Windows.Interactivity"> | ||
<HintPath>..\..\..\ControlzEx\lib\net462\System.Windows.Interactivity.dll</HintPath> | ||
<Private>True</Private> | ||
<Paket>True</Paket> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
</Choose>""" | ||
|
||
let expectedWithSpecificVersionSetToTrue = """ | ||
<Choose xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.0.3')"> | ||
<ItemGroup> | ||
<Reference Include="ControlzEx"> | ||
<HintPath>..\..\..\ControlzEx\lib\net40\ControlzEx.dll</HintPath> | ||
<Private>True</Private> | ||
<SpecificVersion>True</SpecificVersion> | ||
<Paket>True</Paket> | ||
</Reference> | ||
<Reference Include="System.Windows.Interactivity"> | ||
<HintPath>..\..\..\ControlzEx\lib\net40\System.Windows.Interactivity.dll</HintPath> | ||
<Private>True</Private> | ||
<SpecificVersion>True</SpecificVersion> | ||
<Paket>True</Paket> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')"> | ||
<ItemGroup> | ||
<Reference Include="ControlzEx"> | ||
<HintPath>..\..\..\ControlzEx\lib\net45\ControlzEx.dll</HintPath> | ||
<Private>True</Private> | ||
<SpecificVersion>True</SpecificVersion> | ||
<Paket>True</Paket> | ||
</Reference> | ||
<Reference Include="System.Windows.Interactivity"> | ||
<HintPath>..\..\..\ControlzEx\lib\net45\System.Windows.Interactivity.dll</HintPath> | ||
<Private>True</Private> | ||
<SpecificVersion>True</SpecificVersion> | ||
<Paket>True</Paket> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')"> | ||
<ItemGroup> | ||
<Reference Include="ControlzEx"> | ||
<HintPath>..\..\..\ControlzEx\lib\net462\ControlzEx.dll</HintPath> | ||
<Private>True</Private> | ||
<SpecificVersion>True</SpecificVersion> | ||
<Paket>True</Paket> | ||
</Reference> | ||
<Reference Include="System.Windows.Interactivity"> | ||
<HintPath>..\..\..\ControlzEx\lib\net462\System.Windows.Interactivity.dll</HintPath> | ||
<Private>True</Private> | ||
<SpecificVersion>True</SpecificVersion> | ||
<Paket>True</Paket> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
</Choose>""" | ||
|
||
let expectedWithSpecificVersionSetToFalse = """ | ||
<Choose xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.0.3')"> | ||
<ItemGroup> | ||
<Reference Include="ControlzEx"> | ||
<HintPath>..\..\..\ControlzEx\lib\net40\ControlzEx.dll</HintPath> | ||
<Private>True</Private> | ||
<SpecificVersion>False</SpecificVersion> | ||
<Paket>True</Paket> | ||
</Reference> | ||
<Reference Include="System.Windows.Interactivity"> | ||
<HintPath>..\..\..\ControlzEx\lib\net40\System.Windows.Interactivity.dll</HintPath> | ||
<Private>True</Private> | ||
<SpecificVersion>False</SpecificVersion> | ||
<Paket>True</Paket> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')"> | ||
<ItemGroup> | ||
<Reference Include="ControlzEx"> | ||
<HintPath>..\..\..\ControlzEx\lib\net45\ControlzEx.dll</HintPath> | ||
<Private>True</Private> | ||
<SpecificVersion>False</SpecificVersion> | ||
<Paket>True</Paket> | ||
</Reference> | ||
<Reference Include="System.Windows.Interactivity"> | ||
<HintPath>..\..\..\ControlzEx\lib\net45\System.Windows.Interactivity.dll</HintPath> | ||
<Private>True</Private> | ||
<SpecificVersion>False</SpecificVersion> | ||
<Paket>True</Paket> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')"> | ||
<ItemGroup> | ||
<Reference Include="ControlzEx"> | ||
<HintPath>..\..\..\ControlzEx\lib\net462\ControlzEx.dll</HintPath> | ||
<Private>True</Private> | ||
<SpecificVersion>False</SpecificVersion> | ||
<Paket>True</Paket> | ||
</Reference> | ||
<Reference Include="System.Windows.Interactivity"> | ||
<HintPath>..\..\..\ControlzEx\lib\net462\System.Windows.Interactivity.dll</HintPath> | ||
<Private>True</Private> | ||
<SpecificVersion>False</SpecificVersion> | ||
<Paket>True</Paket> | ||
</Reference> | ||
</ItemGroup> | ||
</When> | ||
</Choose>""" | ||
|
||
[<Test>] | ||
let ``should generate Xml without specific version for ControlzEx in CSharp project``() = | ||
ensureDir() | ||
let model = | ||
InstallModel.CreateFromLibs(PackageName "ControlzEx", SemVer.Parse "3.0.1", FrameworkRestriction.NoRestriction, | ||
[ @"..\ControlzEx\lib\net40\ControlzEx.dll" | ||
@"..\ControlzEx\lib\net40\System.Windows.Interactivity.dll" | ||
@"..\ControlzEx\lib\net45\ControlzEx.dll" | ||
@"..\ControlzEx\lib\net45\System.Windows.Interactivity.dll" | ||
@"..\ControlzEx\lib\net462\ControlzEx.dll" | ||
@"..\ControlzEx\lib\net462\System.Windows.Interactivity.dll"] | ||
|> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\ControlzEx\", | ||
[], | ||
[], | ||
Nuspec.All) | ||
|
||
let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyCsharpGuid.csprojtest") | ||
Assert.IsTrue(project.IsSome) | ||
let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,None,None,true,KnownTargetProfiles.AllProfiles,None) | ||
let result = | ||
ctx.ChooseNodes | ||
|> (fun n -> n.Head.OuterXml) | ||
|> normalizeXml | ||
let expectedXml = normalizeXml expectedWithoutSpecificVersion | ||
result |> shouldEqual expectedXml | ||
|
||
[<Test>] | ||
let ``should generate Xml with specific version set to true for ControlzEx in CSharp project``() = | ||
ensureDir() | ||
let model = | ||
InstallModel.CreateFromLibs(PackageName "ControlzEx", SemVer.Parse "3.0.1", FrameworkRestriction.NoRestriction, | ||
[ @"..\ControlzEx\lib\net40\ControlzEx.dll" | ||
@"..\ControlzEx\lib\net40\System.Windows.Interactivity.dll" | ||
@"..\ControlzEx\lib\net45\ControlzEx.dll" | ||
@"..\ControlzEx\lib\net45\System.Windows.Interactivity.dll" | ||
@"..\ControlzEx\lib\net462\ControlzEx.dll" | ||
@"..\ControlzEx\lib\net462\System.Windows.Interactivity.dll"] | ||
|> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\ControlzEx\", | ||
[], | ||
[], | ||
Nuspec.All) | ||
|
||
let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyCsharpGuid.csprojtest") | ||
Assert.IsTrue(project.IsSome) | ||
let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,None,Some true,true,KnownTargetProfiles.AllProfiles,None) | ||
let result = | ||
ctx.ChooseNodes | ||
|> (fun n -> n.Head.OuterXml) | ||
|> normalizeXml | ||
let expectedXml = normalizeXml expectedWithSpecificVersionSetToTrue | ||
result |> shouldEqual expectedXml | ||
|
||
[<Test>] | ||
let ``should generate Xml with specific version set to false for ControlzEx in CSharp project``() = | ||
ensureDir() | ||
let model = | ||
InstallModel.CreateFromLibs(PackageName "ControlzEx", SemVer.Parse "3.0.1", FrameworkRestriction.NoRestriction, | ||
[ @"..\ControlzEx\lib\net40\ControlzEx.dll" | ||
@"..\ControlzEx\lib\net40\System.Windows.Interactivity.dll" | ||
@"..\ControlzEx\lib\net45\ControlzEx.dll" | ||
@"..\ControlzEx\lib\net45\System.Windows.Interactivity.dll" | ||
@"..\ControlzEx\lib\net462\ControlzEx.dll" | ||
@"..\ControlzEx\lib\net462\System.Windows.Interactivity.dll"] | ||
|> Paket.InstallModel.ProcessingSpecs.fromLegacyList @"..\ControlzEx\", | ||
[], | ||
[], | ||
Nuspec.All) | ||
|
||
let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyCsharpGuid.csprojtest") | ||
Assert.IsTrue(project.IsSome) | ||
let ctx = project.Value.GenerateXml(model, System.Collections.Generic.HashSet<_>(),Map.empty,None,Some false,true,KnownTargetProfiles.AllProfiles,None) | ||
let result = | ||
ctx.ChooseNodes | ||
|> (fun n -> n.Head.OuterXml) | ||
|> normalizeXml | ||
let expectedXml = normalizeXml expectedWithSpecificVersionSetToFalse | ||
result |> shouldEqual expectedXml |
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
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
Oops, something went wrong.