xamarin-macios/tests/introspection
monojenkins daf5006281 [d16-2] [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects. (#6035)
* [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects.

Fixes https://github.com/mono/mono/issues/13483 :

```
@akoeplinger: Since we moved types from Mono.Android.dll and
Xamarin.iOS/WatchOS/TVOS.dll to System.Drawing.Common.dll user projects
would fail to compile. We need to add some msbuild logic to add a
reference to the assembly automatically.
```

* [msbuild] Implement the same fix for XM projects as well.

* [msbuild] Update Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* 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
         #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" >

* [tests] Adjust Xamarin.MMP.Tests.AssemblyReferencesTests.ShouldNotAllowReference_ToSystemDrawing.

The test was verifying that referencing System.Drawing.dll and trying to use
System.Drawing.RectangleF would fail to compile (because System.Drawing.dll
shouldn't be resolved in this case).

The addition of System.Drawing.Common.dll breaks this assumption, because now
we ship System.Drawing.RectangleF, so the code that was supposed to fail to
compile works just fine instead.

So modify the test to verify that there's no System.Drawing.dll in the final
bundle.

* Remove workarounds for mono/mono#13483.

* [msbuild] Create a way out if automatically referencing System.Drawing.Common.dll causes problems.

* [msbuild] Adjust variable name and boolean logic according to review.
2019-05-10 16:16:01 +02:00
..
Mac Add System.Data reference to introspection-mac.csproj 2019-02-01 12:47:00 +01:00
iOS [d16-2] [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects. (#6035) 2019-05-10 16:16:01 +02:00
ApiAvailabilityTest.cs Merge branch 'xcode10.2' into master-merge-xcode10.2 2019-04-03 13:57:31 -04:00
ApiBaseTest.cs [PDFKit] Update bindings to Xcode 10 Beta 1, 2 & 3 (#4439) 2018-07-13 14:14:05 -05:00
ApiCMAttachmentTest.cs [corefoundation] Add missing CFStringTransform API. Fixes #5705 (#5712) 2019-03-06 08:04:17 -05:00
ApiClassPtrTest.cs Move parts of dontlink tests into new introspection tests (#32) 2016-05-04 20:14:32 -04:00
ApiCoreImageFiltersTest.cs [coreimage] Add new CISaliencyMapFilter from beta 4 (#4513) 2018-07-27 08:27:23 -04:00
ApiCtorInitTest.cs [tests][intro] Fix post xcode10.2 merge (since reflection string output changed) 2019-04-05 14:17:36 -05:00
ApiFieldTest.cs Merge xcode9 into d15-4[-xi] (#2710) 2017-09-15 17:53:16 -04:00
ApiFrameworkTest.cs [linker] Adjust HttpClientHandler selection with the new (non BCL) location of the handlers 2019-04-01 21:24:24 -05:00
ApiPInvokeTest.cs Merge branch 'master' into mono-2018-10 2019-02-05 21:38:47 +01:00
ApiProtocolTest.cs [introspection] A few tweaks for iOS 8.1 / tvOS 9.0 / watchOS 2.0. 2019-05-09 13:24:43 +02:00
ApiSelectorTest.cs [introspection] A few tweaks for iOS 8.1 / tvOS 9.0 / watchOS 2.0. 2019-05-09 13:24:43 +02:00
ApiSignatureTest.cs Merge xcode9 into d15-4[-xi] (#2710) 2017-09-15 17:53:16 -04:00
ApiStructTest.cs Move parts of dontlink tests into new introspection tests (#32) 2016-05-04 20:14:32 -04:00
ApiTypoTest.cs Merge branch 'xcode10.2' into master-merge-xcode10.2 2019-04-03 13:57:31 -04:00
ApiWeakPropertyTest.cs [homekit] Expose weakly-typed API since the constants are extensible. Fixed #60303 (#3025) 2017-11-21 20:50:33 -05:00
CoreSelectorTest.cs [macos] Fix introspection tests (typo + NSUrlSession* test sharing) 2016-09-06 13:32:51 -04:00
EnvironmentVariable.cs Move parts of dontlink tests into new introspection tests (#32) 2016-05-04 20:14:32 -04:00
README.md [tests] Move linker tests from maccore (#69) 2016-05-20 14:07:34 -04:00
xamarin1.png Move parts of dontlink tests into new introspection tests (#32) 2016-05-04 20:14:32 -04:00

README.md

Introspection Tests

Introspection tests are executed on target (both simulator and device for iOS) or a specific version of OSX. The application proceed to analyze itself using:

  • System.Reflection for managed code; and
  • the ObjectiveC runtime library for native code

and compare the results. E.g. if using .NET reflection it can see a binding for a NSBundle type then it should be able to find a native NSBundle type using the ObjC runtime functions. Otherwise an error is raised...

Since the application analyze itself it must contains everything we wish to test. That's why the introspection tests needs to be built with the managed linker disable, i.e. "Don't link".

Pros

  • The tests always tell the truth, which can differ from documentation or header files;

Cons

  • Incomplete - Not everything is encoded in the metadata / executable;
  • Too complete - Not every truth is good to be known (or published), which requires creating special cases in the tests