Skip to content

Commit

Permalink
[msbuild] Update Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblie…
Browse files Browse the repository at this point in the history
…s_* tests.

We're including a new assembly, which means the
Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* must be updated
accordingly.

Also modify these tests so that test assert that fails lists the actual
assembly that's missing, i.e. instead of this:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         xamarin#1
      Expected: 6
      But was:  7

we now print:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         References
      Expected: equivalent to < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Xml.dll", "Xamarin.iOS.dll" >
      But was:  < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Drawing.Common.dll", "System.Xml.dll", "Xamarin.iOS.dll" >
  • Loading branch information
rolfbjarne authored and monojenkins committed May 9, 2019
1 parent 3a9ee82 commit 6e6ae18
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions msbuild/tests/Xamarin.iOS.Tasks.Tests/TargetTests/TargetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,28 +139,38 @@ public void GetReferencedAssemblies_Executable ()
{
RunTargetOnInstance (MonoTouchProjectInstance, TargetName.ResolveReferences);
var references = MonoTouchProjectInstance.GetItems ("ReferencePath").ToArray ();
var expected_references = new string[] {
"MyLibrary.dll",
"System.dll",
"System.Xml.dll",
"System.Core.dll",
"mscorlib.dll",
"Xamarin.iOS.dll",
"System.Drawing.Common.dll",
};
Array.Sort (expected_references);

Assert.AreEqual (6, references.Length, "#1");
Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("MyLibrary")), "#2");
Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("System")), "#3a");
Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("System.Xml")), "#3b");
Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("System.Core")), "#3c");
Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("mscorlib")), "#3d");
Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("Xamarin.iOS")), "#3e");
var actual_references = references.Select ((v) => Path.GetFileName (v.EvaluatedInclude)).OrderBy ((v) => v);
CollectionAssert.AreEquivalent (expected_references, actual_references, "References");
}

[Test]
public void GetReferencedAssemblies_Library ()
{
RunTargetOnInstance (LibraryProjectInstance, TargetName.ResolveReferences);
var references = LibraryProjectInstance.GetItems ("ReferencePath").ToArray ();

Assert.AreEqual (5, references.Length, "#1");
Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("System")), "#2a");
Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("System.Xml")), "#2b");
Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("System.Core")), "#2c");
Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("mscorlib")), "#2d");
Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("Xamarin.iOS")), "#2e");
var expected_references = new string[] {
"System.dll",
"System.Xml.dll",
"System.Core.dll",
"mscorlib.dll",
"Xamarin.iOS.dll",
"System.Drawing.Common.dll",
};
Array.Sort (expected_references);

var actual_references = references.Select ((v) => Path.GetFileName (v.EvaluatedInclude)).OrderBy ((v) => v);
CollectionAssert.AreEquivalent (expected_references, actual_references, "References");
}

[Test]
Expand Down

0 comments on commit 6e6ae18

Please sign in to comment.