Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<MicrosoftBuildTasksCorePackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildTasksCorePackageVersion>
<MicrosoftBuildUtilitiesCorePackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildUtilitiesCorePackageVersion>
<NUnitConsoleRunnerPackageVersion>3.22.0</NUnitConsoleRunnerPackageVersion>
<NUnitXmlTestLoggerPackageVersion>3.1.15</NUnitXmlTestLoggerPackageVersion>
<NUnitXmlTestLoggerPackageVersion>8.0.0</NUnitXmlTestLoggerPackageVersion>
<!-- Fix transient dependency issue found by component governance 4.7.0 -> 4.7.2 brought by Microsoft.Build package -->
<SystemDrawingCommonPackageVersion>4.7.2</SystemDrawingCommonPackageVersion>
<!-- Fix transient dependency issue found by component governance 4.7.0 -> 4.7.1 brought by Microsoft.Build.Tasks.Core package -->
Expand All @@ -19,11 +19,11 @@
<libclangPackageVersion>21.1.8</libclangPackageVersion>
<MicrosoftNETTestSdkPackageVersion>18.0.1</MicrosoftNETTestSdkPackageVersion>
<MonoCecilPackageVersion>0.11.6</MonoCecilPackageVersion>
<NUnit3TestAdapterPackageVersion>6.1.0</NUnit3TestAdapterPackageVersion>
<NUnitAnalyzersPackageVersion>4.7.0</NUnitAnalyzersPackageVersion>
<NUnitPackageVersion>4.4.0</NUnitPackageVersion>
<NUnitLitePackageVersion>3.12.0</NUnitLitePackageVersion>
<NUnitV2ResultWriterPackageVersion>3.6.0</NUnitV2ResultWriterPackageVersion>
<NUnit3TestAdapterPackageVersion>6.2.0</NUnit3TestAdapterPackageVersion>
<NUnitAnalyzersPackageVersion>4.13.0</NUnitAnalyzersPackageVersion>
<NUnitPackageVersion>4.6.1</NUnitPackageVersion>
<NUnitLitePackageVersion>$(NUnitPackageVersion)</NUnitLitePackageVersion>
<NUnitV2ResultWriterPackageVersion>3.8.0</NUnitV2ResultWriterPackageVersion>

<!-- Use the latest C# version by default -->
<LangVersion Condition="'$(LangVersion)' == ''">latest</LangVersion>
Expand Down
14 changes: 14 additions & 0 deletions tests/common/shared-dotnet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
<DefineConstants>$(DefineConstants);NATIVEAOT</DefineConstants>
<!-- We're enabling warnaserror by default, but we're not warning-free for ILC (especially for NUnit), so disable warnaserror for ILC - https://github.com/dotnet/macios/issues/19911 -->
<IlcTreatWarningsAsErrors>false</IlcTreatWarningsAsErrors>
<!-- NUnit 4.x's EquatablesComparer calls Type.GetInterfaceMap() which requires complete type metadata.
Without this, any Assert.That(x, Is.EqualTo(y)) where x implements IEquatable<T> will throw
NotSupportedException on NativeAOT. See https://github.com/nunit/nunit/issues/3970 -->
<IlcGenerateCompleteTypeMetadata>true</IlcGenerateCompleteTypeMetadata>
<IlcTrimMetadata>false</IlcTrimMetadata>
</PropertyGroup>

<!-- Trimmer options -->
Expand All @@ -101,8 +106,12 @@
<ManagedAssemblyToLink Condition="'%(Filename)' == 'nunit.framework'">
<TrimmerSingleWarn>true</TrimmerSingleWarn>
</ManagedAssemblyToLink>
<ManagedAssemblyToLink Condition="'%(Filename)' == 'nunit.framework.legacy'">
<TrimmerSingleWarn>true</TrimmerSingleWarn>
</ManagedAssemblyToLink>
<!-- The above ItemGroup doesn't work for NativeAOT, so pass the argument manually to ILC: https://github.com/dotnet/runtime/issues/94255 -->
<IlcArg Include="--singlewarnassembly:nunit.framework" />
<IlcArg Include="--singlewarnassembly:nunit.framework.legacy" />
</ItemGroup>
</Target>

Expand All @@ -126,6 +135,11 @@
<DefineConstants>$(DefineConstants);NATIVEAOT</DefineConstants>
<!-- We're enabling warnaserror by default, but we're not warning-free for ILC (especially for NUnit), so disable warnaserror for ILC - https://github.com/dotnet/macios/issues/19911 -->
<IlcTreatWarningsAsErrors>false</IlcTreatWarningsAsErrors>
<!-- NUnit 4.x's EquatablesComparer calls Type.GetInterfaceMap() which requires complete type metadata.
Without this, any Assert.That(x, Is.EqualTo(y)) where x implements IEquatable<T> will throw
NotSupportedException on NativeAOT. See https://github.com/nunit/nunit/issues/3970 -->
<IlcGenerateCompleteTypeMetadata>true</IlcGenerateCompleteTypeMetadata>
<IlcTrimMetadata>false</IlcTrimMetadata>
</PropertyGroup>

<!--
Expand Down
1 change: 1 addition & 0 deletions tests/dotnet/UnitTests/BundleStructureTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ internal static void CheckAppBundleContents (ApplePlatform platform, IEnumerable
if (platform != ApplePlatform.MacOSX)
AddMultiRidAssembly (platform, expectedFiles, assemblyDirectory, "MonoTouch.Dialog", runtimeIdentifiers, forceSingleRid: (platform == ApplePlatform.MacCatalyst && !isReleaseBuild), includeDebugFiles: includeDebugFiles);
expectedFiles.Add (Path.Combine (assemblyDirectory, "nunit.framework.dll"));
expectedFiles.Add (Path.Combine (assemblyDirectory, "nunit.framework.legacy.dll"));
expectedFiles.Add (Path.Combine (assemblyDirectory, "nunitlite.dll"));
expectedFiles.Add (Path.Combine (assemblyDirectory, "Mono.Options.dll"));
AddMultiRidAssembly (platform, expectedFiles, assemblyDirectory, "Touch.Client", runtimeIdentifiers, platform == ApplePlatform.MacOSX || (platform == ApplePlatform.MacCatalyst && !isReleaseBuild), includeDebugFiles: includeDebugFiles);
Expand Down
6 changes: 3 additions & 3 deletions tests/monotouch-test/AppKit/NSPasteboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public void DetectPatternTests_StronglyTyped ()
Assert.That (evt.WaitOne (TimeSpan.FromSeconds (1)), "StronglyTyped DetectPatterns #2 wait");
Assert.That (detectedPatterns, Is.Not.Null, "StronglyTyped DetectedPatterns #2 patterns");
Assert.That ((int) detectedPatterns.Count, Is.EqualTo (1), "StronglyTyped DetectedPatterns #2 count");
Assert.That (detectedPatterns, Does.Contain (NSPasteboardDetectionPattern.EmailAddress), "StronglyTyped DetectedPatterns #2 email");
Assert.That (detectedPatterns.Contains (NSPasteboardDetectionPattern.EmailAddress), "StronglyTyped DetectedPatterns #2 email");
Assert.That (error, Is.Null, "StronglyTyped DetectedPatterns #2 error");
} finally {
pasteboard.ReleaseGlobally ();
Expand Down Expand Up @@ -294,7 +294,7 @@ public void DetectValuesTests_StronglyTyped ()
Assert.That (evt.WaitOne (TimeSpan.FromSeconds (1)), "StronglyTyped DetectValues #2 wait");
Assert.That (detected, Is.Not.Null, "StronglyTyped DetectValues #2 patterns");
Assert.That ((int) detected.Count, Is.EqualTo (1), "StronglyTyped DetectValues #2 count");
Assert.That (detected.Keys, Does.Contain (NSPasteboardDetectionPattern.EmailAddress), "StronglyTyped DetectValues #2 email");
Assert.That (detected.Keys.Contains (NSPasteboardDetectionPattern.EmailAddress), "StronglyTyped DetectValues #2 email");
matches = detected.Values.First ();
Assert.That (matches.Length, Is.EqualTo (1), "StronglyTyped DetectValues #2 matches.Length");
match = matches [0];
Expand All @@ -312,7 +312,7 @@ public void DetectValuesTests_StronglyTyped ()
Assert.That (evt.WaitOne (TimeSpan.FromSeconds (1)), "StronglyTyped DetectValues #3 wait");
Assert.That (detected, Is.Not.Null, "StronglyTyped DetectValues #3 patterns");
Assert.That ((int) detected.Count, Is.EqualTo (1), "StronglyTyped DetectValues #3 count");
Assert.That (detected.Keys, Does.Contain (NSPasteboardDetectionPattern.EmailAddress), "StronglyTyped DetectValues #3 email");
Assert.That (detected.Keys.Contains (NSPasteboardDetectionPattern.EmailAddress), "StronglyTyped DetectValues #3 email");
matches = detected.Values.First ();
Assert.That (matches.Length, Is.EqualTo (1), "StronglyTyped DetectValues #3 matches.Length");
match = matches [0];
Expand Down
5 changes: 5 additions & 0 deletions tests/monotouch-test/AppKit/NSView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public void NSViewShouldChangeGestureRecognizers ()

[Test]
[UnconditionalSuppressMessage ("Trimming", "IL2075", Justification = "This test handles APIs that have been linked away, so it's trimmer-safe.")]
[DynamicDependency ("Menu", typeof (AppKit.NSCell))]
[DynamicDependency ("Menu", typeof (AppKit.NSMenuItem))]
[DynamicDependency ("Menu", typeof (AppKit.NSPathControl))]
[DynamicDependency ("Menu", typeof (AppKit.NSPopUpButton))]
[DynamicDependency ("Menu", typeof (AppKit.NSPopUpButtonCell))]
public void AllItemsWithNSMenuShouldAllowNull ()
{
// Can't test NSResponder since it is abstract
Expand Down
1 change: 0 additions & 1 deletion tests/monotouch-test/Foundation/ObjectTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ public void ObserverTest ()
}

[Test]
[Timeout (5000)]
public void InvokeTest ()
{
var evt = new ManualResetEvent (false);
Expand Down
2 changes: 2 additions & 0 deletions tests/monotouch-test/ObjCRuntime/DelegateAndDataSourceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public void DelegateAndDataSourceAllowsNull ()
dataSource.SetValue (instance, null, null);
}
}
} catch (NotSupportedException e) when (e.Message.Contains ("This object cannot be invoked because no code was generated for it")) {
Console.WriteLine ($"Not testing {t.FullName}, because it's been partially trimmed away.");
} catch (TargetInvocationException e) {
failingTypes.Add (t, e.InnerException.Message);
} catch (Exception e) {
Expand Down
2 changes: 1 addition & 1 deletion tests/monotouch-test/ObjCRuntime/RegistrarTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ public virtual NSObject TestOverriddenRetainNSObject ()
[Export ("testNativeEnum1:")]
public virtual void TestNativeEnum1 (NSWritingDirection twd)
{
Assert.That (Enum.GetValues<NSWritingDirection> (), Contains.Item (twd), "TestNativeEnum1");
Assert.That (Enum.GetValues<NSWritingDirection> ().Contains (twd), "TestNativeEnum1");
}

public virtual UIPopoverArrowDirection TestNativeEnum2 {
Expand Down
8 changes: 0 additions & 8 deletions tests/monotouch-test/Security/SecSharedCredentialTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ public void AddSharedWebCredentialNullAccount ()
}

[Test]
// We do not want to block for a long period of time if the event is not set.
// We are testing the fact that the trampoline works.
[Timeout (5000)]
public void AddSharedWebCredentialNotNullPassword ()
{
Action<NSError> handler = (NSError e) => {
Expand All @@ -56,9 +54,7 @@ public void AddSharedWebCredentialNotNullPassword ()
}

[Test]
// We do not want to block for a long period of time if the event is not set.
// We are testing the fact that the trampoline works.
[Timeout (5000)]
public void AddSharedWebCredentialNullPassword ()
{
password = null;
Expand All @@ -69,9 +65,7 @@ public void AddSharedWebCredentialNullPassword ()
}

[Test]
// We do not want to block for a long period of time if the event is not set.
// We are testing the fact that the trampoline works.
[Timeout (5000)]
public void RequestSharedWebCredentialTest ()
{
Action<SecSharedCredentialInfo [], NSError> handler = (SecSharedCredentialInfo [] creds, NSError e) => {
Expand All @@ -81,9 +75,7 @@ public void RequestSharedWebCredentialTest ()
}

[Test]
// We do not want to block for a long period of time if the event is not set.
// We are testing the fact that the trampoline works.
[Timeout (5000)]
public void RequestSharedWebCredentialNullDomainAndAccountTest ()
{
Action<SecSharedCredentialInfo [], NSError> handler = (SecSharedCredentialInfo [] creds, NSError e) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ public void Properties ()

Assert.That (VTFrameRateConversionConfiguration.ProcessorSupported, Is.True, "ProcessorSupported");
Assert.That (VTFrameRateConversionConfiguration.SupportedRevisions, Is.Not.Null, "SupportedRevisions");
Assert.That (VTFrameRateConversionConfiguration.SupportedRevisions, Does.Contain (VTFrameRateConversionConfigurationRevision.Revision1), "SupportedRevisions.Contains");
Assert.That (VTFrameRateConversionConfiguration.SupportedRevisions.Contains (VTFrameRateConversionConfigurationRevision.Revision1), "SupportedRevisions.Contains");
Assert.That (VTFrameRateConversionConfiguration.WeakSupportedRevisions, Is.Not.Null, "WeakSupportedRevisions");
Assert.That (VTFrameRateConversionConfiguration.WeakSupportedRevisions, Does.Contain ((nuint) 1), "WeakSupportedRevisions.Contains");
Assert.That (Enum.GetValues<VTFrameRateConversionConfigurationRevision> (), Does.Contain (VTFrameRateConversionConfiguration.DefaultRevision), "DefaultRevision");
Assert.That (VTFrameRateConversionConfiguration.WeakSupportedRevisions.Contains ((nuint) 1), "WeakSupportedRevisions.Contains");
Assert.That (Enum.GetValues<VTFrameRateConversionConfigurationRevision> ().Contains (VTFrameRateConversionConfiguration.DefaultRevision), "DefaultRevision");
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#if __MACOS__

using System.Linq;

using AVFoundation;
using CoreMedia;
using CoreVideo;
Expand Down Expand Up @@ -34,10 +36,10 @@ public void Properties ()
Assert.That (VTMotionBlurConfiguration.ProcessorSupported, Is.True, "ProcessorSupported");

Assert.That (VTMotionBlurConfiguration.SupportedRevisions, Is.Not.Null, "SupportedRevisions");
Assert.That (VTMotionBlurConfiguration.SupportedRevisions, Does.Contain (VTMotionBlurConfigurationRevision.Revision1), "SupportedRevisions.Contains");
Assert.That (VTMotionBlurConfiguration.SupportedRevisions.Contains (VTMotionBlurConfigurationRevision.Revision1), "SupportedRevisions.Contains");
Assert.That (VTMotionBlurConfiguration.WeakSupportedRevisions, Is.Not.Null, "WeakSupportedRevisions");
Assert.That (VTMotionBlurConfiguration.WeakSupportedRevisions, Does.Contain ((nuint) 1), "WeakSupportedRevisions.Contains");
Assert.That (Enum.GetValues<VTMotionBlurConfigurationRevision> (), Does.Contain (VTMotionBlurConfiguration.DefaultRevision), "DefaultRevision");
Assert.That (VTMotionBlurConfiguration.WeakSupportedRevisions.Contains ((nuint) 1), "WeakSupportedRevisions.Contains");
Assert.That (Enum.GetValues<VTMotionBlurConfigurationRevision> ().Contains (VTMotionBlurConfiguration.DefaultRevision), "DefaultRevision");
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#if __MACOS__

using System.Linq;

using AVFoundation;
using CoreMedia;
using CoreVideo;
Expand Down Expand Up @@ -33,10 +35,10 @@ public void Properties ()
Assert.That (VTOpticalFlowConfiguration.ProcessorSupported, Is.True, "ProcessorSupported");

Assert.That (VTOpticalFlowConfiguration.SupportedRevisions, Is.Not.Null, "SupportedRevisions");
Assert.That (VTOpticalFlowConfiguration.SupportedRevisions, Does.Contain (VTOpticalFlowConfigurationRevision.Revision1), "SupportedRevisions.Contains");
Assert.That (VTOpticalFlowConfiguration.SupportedRevisions.Contains (VTOpticalFlowConfigurationRevision.Revision1), "SupportedRevisions.Contains");
Assert.That (VTOpticalFlowConfiguration.WeakSupportedRevisions, Is.Not.Null, "WeakSupportedRevisions");
Assert.That (VTOpticalFlowConfiguration.WeakSupportedRevisions, Does.Contain ((nuint) 1), "WeakSupportedRevisions.Contains");
Assert.That (Enum.GetValues<VTOpticalFlowConfigurationRevision> (), Does.Contain (VTOpticalFlowConfiguration.DefaultRevision), "DefaultRevision");
Assert.That (VTOpticalFlowConfiguration.WeakSupportedRevisions.Contains ((nuint) 1), "WeakSupportedRevisions.Contains");
Assert.That (Enum.GetValues<VTOpticalFlowConfigurationRevision> ().Contains (VTOpticalFlowConfiguration.DefaultRevision), "DefaultRevision");
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/nunit.framework.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<PropertyGroup>
<XmlLinkerFile>$(MSBuildThisFileDirectory)nunit.framework.xml</XmlLinkerFile>
<AppBundleExtraOptions>--xml=$(XmlLinkerFile) $(AppBundleExtraOptions)</AppBundleExtraOptions>
<AppBundleExtraOptions Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.Mac'">--dlsym:+nunit.framework.dll $(AppBundleExtraOptions)</AppBundleExtraOptions>
<AppBundleExtraOptions Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.Mac'">--dlsym:+nunit.framework.dll --dlsym:+nunit.framework.legacy.dll $(AppBundleExtraOptions)</AppBundleExtraOptions>
</PropertyGroup>
</Project>
10 changes: 0 additions & 10 deletions tools/nunit3-console-3.10.0

This file was deleted.

10 changes: 0 additions & 10 deletions tools/nunit3-console-3.11.1

This file was deleted.

10 changes: 0 additions & 10 deletions tools/nunit3-console-3.12.0

This file was deleted.

10 changes: 0 additions & 10 deletions tools/nunit3-console-3.9.0

This file was deleted.

Loading