Skip to content

Commit

Permalink
Integration test to cover "Redirects/References Move Too Frequently f…
Browse files Browse the repository at this point in the history
  • Loading branch information
RustyF committed Apr 20, 2017
1 parent a9d3a61 commit 2e9b1ed
Show file tree
Hide file tree
Showing 7 changed files with 1,643 additions and 1 deletion.
31 changes: 30 additions & 1 deletion integrationtests/Paket.IntegrationTests/BindingRedirect.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ open System.IO
open NUnit.Framework
open FsUnit
open System.Text.RegularExpressions
open System.Xml
open System.Xml.Linq
open System.Xml.XPath
open Paket

[<Test>]
Expand Down Expand Up @@ -234,4 +237,30 @@ let ``#1783 generates binding redirect when assembly with different version of m
let config = File.ReadAllText(configPath) |> normalizeLineEndings

config |> shouldContainText ``FSharp.Core``
config |> shouldContainText ``Newtonsoft.Json``
config |> shouldContainText ``Newtonsoft.Json``

[<Test>]
let ``#2228 retains order of redirects``() =

let scenario = "i002228-redirect-order"

update scenario |> ignore

let redirectNames (configPathRoot:string) =
let bindingNs = "urn:schemas-microsoft-com:asm.v1"
let xpath = "//bindings:assemblyBinding/bindings:dependentAssembly/bindings:assemblyIdentity"

let nsManager = XmlNamespaceManager(NameTable());
nsManager.AddNamespace("bindings", bindingNs)

let configPath = Path.Combine(Path.Combine configPathRoot, "ConsoleApp1", "app.config")
let configXml = XDocument.Load(configPath, LoadOptions.None)

configXml.XPathSelectElements(xpath, nsManager)
|> Seq.map (fun e -> e.Attribute(XName.Get("name")).Value)
|> Seq.toList

let redirectsBefore = redirectNames (originalScenarioPath scenario)
let redirectsAfter = redirectNames (scenarioTempPath scenario)

redirectsBefore |> shouldEqual redirectsAfter
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.2.10.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="nunit.framework" publicKeyToken="2638cd05610744eb" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="3.6.1.0" />
</dependentAssembly>
</assemblyBinding></runtime>
</configuration>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("yo yo yo");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ConsoleApp1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ConsoleApp1")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0ade9ac7-df03-47f9-b747-cab0fc4c9dad")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Newtonsoft.Json redirects: force
Log4Net redirects: force
NUnit redirects: force

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
redirects: force
source https://nuget.org/api/v2

nuget Newtonsoft.Json
nuget Log4Net 1.2.10
nuget NUnit

0 comments on commit 2e9b1ed

Please sign in to comment.