[tests] Change TestRuntime.CheckSystemVersion to take a ApplePlatform value instead of a PlatformName enum. (#13350)

The PlatformName enum will be removed from .NET soon.
This commit is contained in:
Rolf Bjarne Kvinge 2021-11-15 08:06:36 +01:00 коммит произвёл GitHub
Родитель 7a76bbeb64
Коммит 66e596e9d9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
205 изменённых файлов: 712 добавлений и 493 удалений

Просмотреть файл

@ -53,6 +53,9 @@
<Compile Include="..\common\TestRuntime.cs">
<Link>TestRuntime.cs</Link>
</Compile>
<Compile Include="..\..\tools\common\ApplePlatform.cs">
<Link>ApplePlatform.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Welcome.resx">

Просмотреть файл

@ -19,6 +19,9 @@
<Compile Include="$(RootTestsDirectory)\common\TestRuntime.cs">
<Link>TestRuntime.cs</Link>
</Compile>
<Compile Include="$(RootTestsDirectory)\..\tools\common\ApplePlatform.cs">
<Link>ApplePlatform.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -50,6 +50,9 @@
<Compile Include="$(RootTestsDirectory)\common\TestRuntime.cs">
<Link>TestRuntime.cs</Link>
</Compile>
<Compile Include="$(RootTestsDirectory)\..\tools\common\ApplePlatform.cs">
<Link>ApplePlatform.cs</Link>
</Compile>
<Compile Include="$(BindingsTestDirectory)\RuntimeTest.cs" />
<Compile Include="$(BindingsTestDirectory)\CodeBehind.cs" />
<Compile Include="$(BindingsTestDirectory)\Messaging.cs" />

Просмотреть файл

@ -81,6 +81,9 @@
<Compile Include="..\..\common\TestRuntime.cs">
<Link>TestRuntime.cs</Link>
</Compile>
<Compile Include="..\..\..\tools\common\ApplePlatform.cs">
<Link>ApplePlatform.cs</Link>
</Compile>
<Compile Include="..\RuntimeTest.cs" />
<Compile Include="..\CodeBehind.cs" />
<Compile Include="..\Messaging.cs" />

Просмотреть файл

@ -68,6 +68,9 @@
<Compile Include="..\..\common\TestRuntime.cs">
<Link>TestRuntime.cs</Link>
</Compile>
<Compile Include="..\..\..\tools\common\ApplePlatform.cs">
<Link>ApplePlatform.cs</Link>
</Compile>
<Compile Include="..\RuntimeTest.cs" />
<Compile Include="..\CodeBehind.cs" />
<Compile Include="..\Messaging.cs" />

Просмотреть файл

@ -31,6 +31,8 @@ using UIKit;
#endif
using ObjCRuntime;
using Xamarin.Utils;
partial class TestRuntime
{
@ -744,38 +746,40 @@ partial class TestRuntime
}
}
public static bool CheckSystemVersion (PlatformName platform, int major, int minor, int build = 0, bool throwIfOtherPlatform = true)
public static bool CheckSystemVersion (ApplePlatform platform, int major, int minor, int build = 0, bool throwIfOtherPlatform = true)
{
switch (platform) {
case PlatformName.iOS:
case ApplePlatform.iOS:
return CheckiOSSystemVersion (major, minor, throwIfOtherPlatform);
case PlatformName.MacOSX:
case ApplePlatform.MacOSX:
return CheckMacSystemVersion (major, minor, build, throwIfOtherPlatform);
case PlatformName.TvOS:
case ApplePlatform.TVOS:
return ChecktvOSSystemVersion (major, minor, throwIfOtherPlatform);
case PlatformName.WatchOS:
case ApplePlatform.WatchOS:
return CheckWatchOSSystemVersion (major, minor, throwIfOtherPlatform);
case ApplePlatform.MacCatalyst:
return CheckMacCatalystSystemVersion (major, minor, throwIfOtherPlatform);
default:
throw new Exception ($"Unknown platform: {platform}");
}
}
public static void AssertSystemVersion (PlatformName platform, int major, int minor, int build = 0, bool throwIfOtherPlatform = true)
public static void AssertSystemVersion (ApplePlatform platform, int major, int minor, int build = 0, bool throwIfOtherPlatform = true)
{
switch (platform) {
case PlatformName.iOS:
case ApplePlatform.iOS:
AssertiOSSystemVersion (major, minor, throwIfOtherPlatform);
break;
case PlatformName.MacOSX:
case ApplePlatform.MacOSX:
AssertMacSystemVersion (major, minor, build, throwIfOtherPlatform);
break;
case PlatformName.TvOS:
case ApplePlatform.TVOS:
AsserttvOSSystemVersion (major, minor, throwIfOtherPlatform);
break;
case PlatformName.WatchOS:
case ApplePlatform.WatchOS:
AssertWatchOSSystemVersion (major, minor, throwIfOtherPlatform);
break;
case PlatformName.MacCatalyst:
case ApplePlatform.MacCatalyst:
AssertMacCatalystSystemVersion (major, minor, build, throwIfOtherPlatform);
break;
default:

Просмотреть файл

@ -34,6 +34,7 @@ using AppKit;
using UIKit;
#endif
using Foundation;
using Xamarin.Utils;
namespace Introspection
{
@ -1001,7 +1002,7 @@ namespace Introspection
case Constants.CoreImageLibrary:
break;
default:
if (TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 11, 0)) {
if (TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 11, 0)) {
// on macOS 11.0 the frameworks binary files are not present (cache) but can be loaded
if (!Directory.Exists (Path.GetDirectoryName (lib)))
return false;

Просмотреть файл

@ -15,6 +15,7 @@ using Foundation;
using NUnit.Framework;
using Xamarin.Tests;
using Xamarin.Utils;
namespace Introspection {
@ -142,7 +143,7 @@ namespace Introspection {
// https://trello.com/c/T6vkA2QF/62-29311598-ikpicturetaker-crashes-randomly-upon-deallocation?menu=filter&filter=corenfc
return true;
case "Photos.PHProjectChangeRequest":
if (TestRuntime.CheckSystemVersion (ObjCRuntime.PlatformName.MacOSX, 10, 15)) {
if (TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 15)) {
/*
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This method can only be called from inside of -[PHPhotoLibrary performChanges:completionHandler:] or -[PHPhotoLibrary performChangesAndWait:error:]'
0 CoreFoundation 0x00007fff34f29063 __exceptionPreprocess + 250

Просмотреть файл

@ -16,6 +16,7 @@ using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Tests;
using Xamarin.Utils;
namespace Introspection {
@ -696,7 +697,7 @@ namespace Introspection {
switch (selectorName) {
case "buttonPressed":
// It's just gone! https://github.com/xamarin/maccore/issues/1796
if (TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 15))
if (TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 15))
return true;
break;
}
@ -709,7 +710,7 @@ namespace Introspection {
switch (selectorName) {
case "isSyncFailureHidden":
// It's just gone! https://github.com/xamarin/maccore/issues/1797
if (TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 15))
if (TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 15))
return true;
break;
}

Просмотреть файл

@ -15,6 +15,7 @@ using Foundation;
using ObjCRuntime;
using UIKit;
using NUnit.Framework;
using Xamarin.Utils;
namespace Introspection {
@ -74,7 +75,7 @@ namespace Introspection {
// 1. is the current SDK target (or a newer one)
var sdk = new Version (Constants.SdkVersion);
#if __WATCHOS__
if (!TestRuntime.CheckSystemVersion (PlatformName.WatchOS, sdk.Major, sdk.Minor))
if (!TestRuntime.CheckSystemVersion (ApplePlatform.WatchOS, sdk.Major, sdk.Minor))
return true;
#elif __IOS__ || __TVOS__
if (!UIDevice.CurrentDevice.CheckSystemVersion (sdk.Major, sdk.Minor))

Просмотреть файл

@ -53,6 +53,7 @@ using OpenGLES;
using WebKit;
using NUnit.Framework;
using MonoTests.System.Net.Http;
using Xamarin.Utils;
namespace LinkSdk {
@ -185,7 +186,7 @@ namespace LinkSdk {
// http://bugzilla.xamarin.com/show_bug.cgi?id=980
public void Bug980_AddressBook_NRE ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false); // The AddressBook framework was introduced in Mac Catalyst 14.0
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false); // The AddressBook framework was introduced in Mac Catalyst 14.0
using (ABPeoplePickerNavigationController picker = new ABPeoplePickerNavigationController ()) {
// no NRE should occur
if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0))
@ -206,7 +207,7 @@ namespace LinkSdk {
"Please deny access to contacts for this this application (it's important for this test)");
}
#endif // !__MACOS__
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false); // The AddressBook framework was introduced in Mac Catalyst 14.0
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false); // The AddressBook framework was introduced in Mac Catalyst 14.0
Assert.IsNotNull (ABPersonAddressKey.City, "ABPersonAddressKey");
}
#endif // HAS_ADDRESSBOOKUI
@ -928,7 +929,7 @@ namespace LinkSdk {
#endif
#if __MACOS__
var isMac1015 = TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 15);
var isMac1015 = TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 15);
path = TestFolder (Environment.SpecialFolder.Favorites, supported: isMac1015, exists: isMac1015);
#elif __MACCATALYST__
path = TestFolder (Environment.SpecialFolder.Favorites, exists: true);

Просмотреть файл

@ -67,6 +67,9 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Stub.cs" />
<Compile Include="..\..\..\..\tools\common\ApplePlatform.cs">
<Link>ApplePlatform.cs</Link>
</Compile>
<Compile Include="..\..\..\common\mac\MacMain.cs">
<Link>MacMain.cs</Link>
</Compile>

Просмотреть файл

@ -79,6 +79,9 @@
</Compile>
<Compile Include="..\..\BaseOptimizeGeneratedCodeTest.cs" />
<Compile Include="LinkAllTest.cs" />
<Compile Include="..\..\..\..\tools\common\ApplePlatform.cs">
<Link>ApplePlatform.cs</Link>
</Compile>
<Compile Include="..\..\..\common\PlatformInfo.cs">
<Link>PlatformInfo.cs</Link>
</Compile>

Просмотреть файл

@ -73,6 +73,9 @@
<Link>Mac.cs</Link>
</Compile>
<Compile Include="LinkSdkTest.cs" />
<Compile Include="..\..\..\..\tools\common\ApplePlatform.cs">
<Link>ApplePlatform.cs</Link>
</Compile>
<Compile Include="..\..\..\common\PlatformInfo.cs">
<Link>PlatformInfo.cs</Link>
</Compile>

Просмотреть файл

@ -14,6 +14,7 @@ using ARKit;
using Foundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
using MatrixFloat4x4 = global::OpenTK.NMatrix4;
@ -28,7 +29,7 @@ namespace MonoTouchFixtures.ARKit {
{
TestRuntime.AssertXcodeVersion (10, 0);
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -6,6 +6,7 @@ using ARKit;
using Foundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.ARKit {
@ -18,7 +19,7 @@ namespace MonoTouchFixtures.ARKit {
{
TestRuntime.AssertXcodeVersion (9, 3);
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -14,6 +14,7 @@ using ARKit;
using Foundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
using VectorFloat3 = global::OpenTK.NVector3;
using MatrixFloat4x4 = global::OpenTK.NMatrix4;
@ -29,7 +30,7 @@ namespace MonoTouchFixtures.ARKit {
{
TestRuntime.AssertXcodeVersion (10, 0);
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -16,6 +16,7 @@ using ARKit;
using Foundation;
using NUnit.Framework;
using ObjCRuntime;
using Xamarin.Utils;
using VectorFloat2 = global::OpenTK.Vector2;
using VectorFloat3 = global::OpenTK.NVector3;
@ -89,7 +90,7 @@ namespace MonoTouchFixtures.ARKit {
{
TestRuntime.AssertXcodeVersion (9, 0);
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -16,6 +16,7 @@ using ARKit;
using Foundation;
using NUnit.Framework;
using ObjCRuntime;
using Xamarin.Utils;
using VectorFloat2 = global::OpenTK.Vector2;
using VectorFloat3 = global::OpenTK.NVector3;
@ -103,7 +104,7 @@ namespace MonoTouchFixtures.ARKit {
{
TestRuntime.AssertXcodeVersion (9, 0);
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -17,6 +17,7 @@ using AVFoundation;
using Foundation;
using NUnit.Framework;
using ObjCRuntime;
using Xamarin.Utils;
using MatrixFloat2x2 = global::OpenTK.NMatrix2;
using MatrixFloat3x3 = global::OpenTK.NMatrix3;
@ -78,7 +79,7 @@ namespace MonoTouchFixtures.ARKit {
{
TestRuntime.AssertXcodeVersion (9, 0);
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -14,6 +14,7 @@ using ARKit;
using Foundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
using VectorFloat3 = global::OpenTK.NVector3;
using MatrixFloat4x4 = global::OpenTK.NMatrix4;
@ -29,7 +30,7 @@ namespace MonoTouchFixtures.ARKit {
{
TestRuntime.AssertXcodeVersion (10, 0);
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -16,6 +16,7 @@ using ARKit;
using Foundation;
using NUnit.Framework;
using ObjCRuntime;
using Xamarin.Utils;
using Vector2 = global::OpenTK.Vector2;
@ -63,7 +64,7 @@ namespace MonoTouchFixtures.ARKit {
{
TestRuntime.AssertXcodeVersion (11, 0);
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -16,6 +16,7 @@ using ARKit;
using Foundation;
using NUnit.Framework;
using ObjCRuntime;
using Xamarin.Utils;
using Matrix4 = global::OpenTK.NMatrix4;
@ -77,7 +78,7 @@ namespace MonoTouchFixtures.ARKit {
{
TestRuntime.AssertXcodeVersion (11, 0);
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -7,6 +7,7 @@ using ARKit;
using Foundation;
using NUnit.Framework;
using ObjCRuntime;
using Xamarin.Utils;
namespace monotouchtest.ARKit {
[TestFixture]
@ -18,7 +19,7 @@ namespace monotouchtest.ARKit {
{
TestRuntime.AssertXcodeVersion (12, 0);
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -18,6 +18,7 @@ using AVFoundation;
using CoreMedia;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.AVFoundation {
@ -95,7 +96,7 @@ namespace MonoTouchFixtures.AVFoundation {
{
// This test deadlocks on Mountain Lion (but works on Lion)
// https://gist.github.com/rolfbjarne/1190d97af79e554c298f2c133dfd8e87
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
handled = false;
mre = new ManualResetEvent (false);

Просмотреть файл

@ -7,6 +7,7 @@ using Foundation;
using AVFoundation;
using NUnit.Framework;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.AVFoundation {
@ -17,8 +18,8 @@ namespace MonoTouchFixtures.AVFoundation {
[SetUp]
public void Setup ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -4,6 +4,7 @@ using Foundation;
using AVFoundation;
using NUnit.Framework;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.AVFoundation {
@ -14,7 +15,7 @@ namespace MonoTouchFixtures.AVFoundation {
[SetUp]
public void SetUp ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 12,0);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 12,0);
}
[TestCase]

Просмотреть файл

@ -4,6 +4,7 @@ using Foundation;
using AVFoundation;
using NUnit.Framework;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.AVFoundation {
@ -14,7 +15,7 @@ namespace MonoTouchFixtures.AVFoundation {
[SetUp]
public void SetUp ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 12,0);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 12,0);
}
[TestCase]

Просмотреть файл

@ -4,6 +4,7 @@ using Foundation;
using AVFoundation;
using NUnit.Framework;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.AVFoundation {
@ -14,7 +15,7 @@ namespace MonoTouchFixtures.AVFoundation {
[SetUp]
public void SetUp ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 12,0);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 12,0);
}
[Test]

Просмотреть файл

@ -3,6 +3,8 @@ using Foundation;
using AVFoundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.AVFoundation {
[TestFixture]
@ -32,12 +34,12 @@ namespace MonoTouchFixtures.AVFoundation {
Compare (AVMediaType.Timecode, AVMediaTypes.Timecode);
Compare (AVMediaType.Video, AVMediaTypes.Video);
if (TestRuntime.CheckSystemVersion (PlatformName.iOS, 9,0))
if (TestRuntime.CheckSystemVersion (ApplePlatform.iOS, 9,0))
Compare (AVMediaType.MetadataObject, AVMediaTypes.MetadataObject);
// obsoleted in iOS 6, removed in iOS12
#if !__MACCATALYST__
if (TestRuntime.CheckSystemVersion (PlatformName.iOS, 12, 0))
if (TestRuntime.CheckSystemVersion (ApplePlatform.iOS, 12, 0))
Assert.Null (AVMediaType.TimedMetadata, "AVMediaTypeTimedMetadata");
else
Compare (AVMediaType.TimedMetadata, AVMediaTypes.TimedMetadata);

Просмотреть файл

@ -16,6 +16,7 @@ using Foundation;
using AVFoundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.AVFoundation {
@ -34,7 +35,7 @@ namespace MonoTouchFixtures.AVFoundation {
Assert.AreEqual (0, obj.WeakAvailableMetadataObjectTypes.Length, "WeakAvailableMetadataObjectTypes#");
Assert.IsNotNull (obj.WeakMetadataObjectTypes, "WeakMetadataObjectTypes");
Assert.AreEqual (0, obj.WeakMetadataObjectTypes.Length, "WeakMetadataObjectTypes#");
if (TestRuntime.CheckSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false))
if (TestRuntime.CheckSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false))
Assert.AreEqual (new CGRect (0, 0, 1, 1), obj.RectOfInterest, "RectOfInterest");
#if !__MACCATALYST__ // https://github.com/xamarin/maccore/issues/2345
@ -90,7 +91,7 @@ namespace MonoTouchFixtures.AVFoundation {
[Test]
public void MetadataObjectTypesTest ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
if (Runtime.Arch != Arch.DEVICE)
Assert.Ignore ("This test only runs on device (requires camera access)");

Просмотреть файл

@ -14,6 +14,7 @@ using Foundation;
using AVFoundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.AVFoundation {
@ -25,7 +26,7 @@ namespace MonoTouchFixtures.AVFoundation {
public void Defaults ()
{
TestRuntime.AssertXcodeVersion (6, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
using (var obj = new AVMetadataFaceObject ()) {
Assert.AreEqual ((nint) 0, obj.FaceID, "FaceID");

Просмотреть файл

@ -15,6 +15,7 @@ using CoreVideo;
using Foundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.AVFoundation {
@ -25,7 +26,7 @@ namespace MonoTouchFixtures.AVFoundation {
[Test]
public void Ctor_CVPixelBufferAttributes ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
var attributes = new CVPixelBufferAttributes () {
PixelFormatType = CVPixelFormatType.CV32BGRA

Просмотреть файл

@ -17,6 +17,7 @@ using AppKit;
using UIKit;
#endif
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.AVFoundation {
@ -29,10 +30,10 @@ namespace MonoTouchFixtures.AVFoundation {
public void SetUp ()
{
#if __WATCHOS__
if (!TestRuntime.CheckSystemVersion (PlatformName.WatchOS, 3, 0))
if (!TestRuntime.CheckSystemVersion (ApplePlatform.WatchOS, 3, 0))
Assert.Inconclusive ("Requires watchOS 3.0+");
#else
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
#endif
}

Просмотреть файл

@ -16,6 +16,7 @@ using UIKit;
using iAd;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.AVKit {
@ -26,7 +27,7 @@ namespace MonoTouchFixtures.AVKit {
[Test]
public void PreparePrerollAds_New ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
AVPlayerViewController.PrepareForPrerollAds ();
}

Просмотреть файл

@ -15,6 +15,7 @@ using UIKit;
using AddressBook;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.AddressBook {
@ -28,7 +29,7 @@ namespace MonoTouchFixtures.AddressBook {
public void Setup ()
{
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]
@ -37,7 +38,7 @@ namespace MonoTouchFixtures.AddressBook {
TestRuntime.CheckAddressBookPermission ();
ABAddressBook ab = new ABAddressBook ();
var sources = ab.GetAllSources ();
int value = Runtime.Arch == Arch.DEVICE || TestRuntime.CheckSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false) ? 0 : 1;
int value = Runtime.Arch == Arch.DEVICE || TestRuntime.CheckSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false) ? 0 : 1;
Assert.That (sources.Length, Is.GreaterThanOrEqualTo (value), "GetAllSources");
}

Просмотреть файл

@ -15,6 +15,7 @@ using UIKit;
using AddressBook;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.AddressBook {
@ -26,7 +27,7 @@ namespace MonoTouchFixtures.AddressBook {
public void Setup ()
{
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -15,6 +15,7 @@ using UIKit;
using AddressBook;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.AddressBook {
@ -26,7 +27,7 @@ namespace MonoTouchFixtures.AddressBook {
public void Setup ()
{
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -16,6 +16,7 @@ using AddressBookUI;
using ObjCRuntime;
using UIKit;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.AddressBookUI {
@ -27,7 +28,7 @@ namespace MonoTouchFixtures.AddressBookUI {
public void Setup ()
{
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]
@ -66,7 +67,7 @@ namespace MonoTouchFixtures.AddressBookUI {
// iOS 8.2 beta 5 (12D5480a) simulator (Xcode 6.2 beta 5): working
// we don't check before 8.2 - where both device and simulators works again properly
if (!TestRuntime.CheckSystemVersion (PlatformName.iOS, 8, 2))
if (!TestRuntime.CheckSystemVersion (ApplePlatform.iOS, 8, 2))
return;
// iOS 11.0 beta 1, 2, 3 and 4 are broken

Просмотреть файл

@ -5,6 +5,7 @@ using NUnit.Framework;
using AppKit;
using ObjCRuntime;
using Foundation;
using Xamarin.Utils;
namespace Xamarin.Mac.Tests
{
@ -14,8 +15,7 @@ namespace Xamarin.Mac.Tests
[Test]
public void NSSearchFieldShouldSetSearchMenuTemplate ()
{
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) < Platform.Mac_10_10)
return;
TestRuntime.AssertXcodeVersion (6, 1);
var searchField = new NSSearchField ();
var searchMenuTemplate = searchField.SearchMenuTemplate;
@ -27,8 +27,7 @@ namespace Xamarin.Mac.Tests
[Test]
public void NSSearchFieldShouldSetSendsWholeSearchString ()
{
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) < Platform.Mac_10_10)
return;
TestRuntime.AssertXcodeVersion (6, 1);
var searchField = new NSSearchField ();
var sendsWholeSearchString = searchField.SendsWholeSearchString;
@ -40,8 +39,7 @@ namespace Xamarin.Mac.Tests
[Test]
public void NSSearchFieldShouldSetMaximumRecents ()
{
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) < Platform.Mac_10_10)
return;
TestRuntime.AssertXcodeVersion (6, 1);
var searchField = new NSSearchField ();
var maximumRecents = searchField.MaximumRecents;
@ -53,8 +51,7 @@ namespace Xamarin.Mac.Tests
[Test]
public void NSSearchFieldShouldSetSendsSearchStringImmediately ()
{
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) < Platform.Mac_10_10)
return;
TestRuntime.AssertXcodeVersion (6, 1);
var searchField = new NSSearchField ();
var sendsSearchStringImmediately = searchField.SendsSearchStringImmediately;

Просмотреть файл

@ -5,6 +5,7 @@ using System;
using AppKit;
using ObjCRuntime;
using Foundation;
using Xamarin.Utils;
namespace Xamarin.Mac.Tests
{
@ -15,8 +16,7 @@ namespace Xamarin.Mac.Tests
[Test]
public void NSSlider_VertialTests()
{
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) < Platform.Mac_10_12)
return;
TestRuntime.AssertXcodeVersion (8, 0);
NSSlider slider = new NSSlider ();
var isVert = slider.IsVertical;

Просмотреть файл

@ -6,6 +6,7 @@ using System.Linq;
using AppKit;
using ObjCRuntime;
using Foundation;
using Xamarin.Utils;
namespace Xamarin.Mac.Tests
{
@ -44,7 +45,7 @@ namespace Xamarin.Mac.Tests
public void NSTabViewControllerShouldChangeSegmentedControl ()
{
// This API was removed in 10.11
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) >= Platform.Mac_10_11)
if (TestRuntime.CheckXcodeVersion (7, 0))
return;
var segmentedControl = controller.SegmentedControl;

Просмотреть файл

@ -4,6 +4,7 @@ using System.Reflection;
using NUnit.Framework;
using Xamarin.Tests;
using Xamarin.Utils;
using ObjCRuntime;
using Foundation;
@ -14,13 +15,13 @@ namespace Xamarin.Mac.Tests
{
public static bool IsAtLeastYosemite {
get {
return PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) >= Platform.Mac_10_10;
return TestRuntime.CheckXcodeVersion (6, 1);
}
}
public static bool IsAtLeastElCapitan {
get {
return PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) >= Platform.Mac_10_11;
return TestRuntime.CheckXcodeVersion (7, 0);
}
}
@ -32,14 +33,12 @@ namespace Xamarin.Mac.Tests
public static void EnsureMavericks ()
{
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) < Platform.Mac_10_9)
Assert.Pass ("This test requires Mavericks. Skipping");
TestRuntime.AssertXcodeVersion (6, 0);
}
public static void EnsureMountainLion ()
{
if (PlatformHelper.ToMacVersion (PlatformHelper.GetHostApiPlatform ()) < Platform.Mac_10_8)
Assert.Pass ("This test requires Mountain Lion. Skipping");
// We're always running on at least Mountain Lion
}
public static void Ensure64Bit ()

Просмотреть файл

@ -14,6 +14,7 @@ using Foundation;
using AudioToolbox;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.AudioToolbox {
@ -26,7 +27,7 @@ namespace MonoTouchFixtures.AudioToolbox {
[Test]
public void GetName ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
Assert.Throws<ArgumentNullException> (delegate { SoundBank.GetName (null); }, "null");
@ -39,7 +40,7 @@ namespace MonoTouchFixtures.AudioToolbox {
[Test]
public void GetName_DLS_SimOnly ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
if (Runtime.Arch == Arch.DEVICE)
Assert.Ignore ("Use local file system (need a smaller sample)");
@ -52,8 +53,8 @@ namespace MonoTouchFixtures.AudioToolbox {
[Test]
public void GetInstrumentInfo ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
Assert.Throws<ArgumentNullException> (delegate { SoundBank.GetInstrumentInfo (null); }, "null");
@ -66,7 +67,7 @@ namespace MonoTouchFixtures.AudioToolbox {
[Test]
public void GetInstrumentInfo_DLS_SimOnly ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
if (Runtime.Arch == Arch.DEVICE)
Assert.Ignore ("Use local file system (need a smaller sample)");

Просмотреть файл

@ -15,6 +15,7 @@ using Foundation;
using AudioToolbox;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.AudioToolbox {
@ -57,7 +58,7 @@ namespace MonoTouchFixtures.AudioToolbox {
public void TestCallbackPlaySystem ()
{
TestRuntime.AssertNotSimulator ();
TestRuntime.AssertSystemVersion (PlatformName.iOS, 9, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 9, 0, throwIfOtherPlatform: false);
string path = Path.Combine (NSBundle.MainBundle.ResourcePath, "drum01.mp3");
@ -77,7 +78,7 @@ namespace MonoTouchFixtures.AudioToolbox {
public void TestCallbackPlayAlert ()
{
TestRuntime.AssertNotSimulator ();
TestRuntime.AssertSystemVersion (PlatformName.iOS, 9, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 9, 0, throwIfOtherPlatform: false);
string path = Path.Combine (NSBundle.MainBundle.ResourcePath, "drum01.mp3");

Просмотреть файл

@ -14,6 +14,7 @@ using NUnit.Framework;
using CarPlay;
using Foundation;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.CarPlay {
@ -26,7 +27,7 @@ namespace MonoTouchFixtures.CarPlay {
{
TestRuntime.AssertXcodeVersion (12, 0);
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -3,6 +3,7 @@ using NUnit.Framework;
using Foundation;
using CloudKit;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.CloudKit
{
@ -18,7 +19,7 @@ namespace MonoTouchFixtures.CloudKit
public void SetUp ()
{
TestRuntime.AssertXcodeVersion (6, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
op = new CKFetchNotificationChangesOperation (token);
}

Просмотреть файл

@ -4,6 +4,7 @@ using NUnit.Framework;
using Foundation;
using CloudKit;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.CloudKit
{
@ -19,7 +20,7 @@ namespace MonoTouchFixtures.CloudKit
public void SetUp ()
{
TestRuntime.AssertXcodeVersion (6, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
zoneID = new CKRecordZoneID ("foo", "xamarin");
op = new CKFetchRecordChangesOperation (zoneID, null);
}

Просмотреть файл

@ -3,6 +3,7 @@ using NUnit.Framework;
using Foundation;
using CloudKit;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.CloudKit
{
@ -18,7 +19,7 @@ namespace MonoTouchFixtures.CloudKit
public void SetUp ()
{
TestRuntime.AssertXcodeVersion (6, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
op = new CKFetchRecordZonesOperation (zoneIDs);
}

Просмотреть файл

@ -3,6 +3,7 @@ using NUnit.Framework;
using Foundation;
using CloudKit;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.CloudKit
{
@ -18,7 +19,7 @@ namespace MonoTouchFixtures.CloudKit
public void SetUp ()
{
TestRuntime.AssertXcodeVersion (6, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
op = new CKFetchRecordsOperation (recordIDs);
}

Просмотреть файл

@ -4,6 +4,7 @@ using NUnit.Framework;
using Foundation;
using CloudKit;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.CloudKit
{
@ -19,7 +20,7 @@ namespace MonoTouchFixtures.CloudKit
public void SetUp ()
{
TestRuntime.AssertXcodeVersion (6, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
op = new CKFetchSubscriptionsOperation (ids);
}

Просмотреть файл

@ -3,6 +3,7 @@ using NUnit.Framework;
using Foundation;
using CloudKit;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.CloudKit
{
@ -18,7 +19,7 @@ namespace MonoTouchFixtures.CloudKit
public void SetUp ()
{
TestRuntime.AssertXcodeVersion (6, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
op = new CKMarkNotificationsReadOperation (notificationIDs);
}

Просмотреть файл

@ -3,6 +3,7 @@ using NUnit.Framework;
using Foundation;
using CloudKit;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.CloudKit
{
@ -17,7 +18,7 @@ namespace MonoTouchFixtures.CloudKit
public void SetUp ()
{
TestRuntime.AssertXcodeVersion (6, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
op = new CKModifyBadgeOperation (3);
}

Просмотреть файл

@ -3,6 +3,7 @@ using NUnit.Framework;
using Foundation;
using CloudKit;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.CloudKit
{
@ -17,7 +18,7 @@ namespace MonoTouchFixtures.CloudKit
public void SetUp ()
{
TestRuntime.AssertXcodeVersion (6, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
op = new CKModifyRecordZonesOperation (null, null);
}

Просмотреть файл

@ -3,6 +3,7 @@ using NUnit.Framework;
using Foundation;
using CloudKit;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.CloudKit
{
@ -17,7 +18,7 @@ namespace MonoTouchFixtures.CloudKit
public void SetUp ()
{
TestRuntime.AssertXcodeVersion (6, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
op = new CKModifyRecordsOperation (null, null);
}

Просмотреть файл

@ -4,6 +4,7 @@ using NUnit.Framework;
using Foundation;
using CloudKit;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.CloudKit
{
@ -18,7 +19,7 @@ namespace MonoTouchFixtures.CloudKit
public void SetUp ()
{
TestRuntime.AssertXcodeVersion (6, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
op = new CKModifySubscriptionsOperation (null, null);
}

Просмотреть файл

@ -3,6 +3,7 @@ using NUnit.Framework;
using Foundation;
using CloudKit;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.CloudKit
{
@ -18,7 +19,7 @@ namespace MonoTouchFixtures.CloudKit
public void SetUp ()
{
TestRuntime.AssertXcodeVersion (6, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
q = new CKQuery ("Foo", NSPredicate.FromFormat ("email = '@xamarin'"));
op = new CKQueryOperation (q);
}

Просмотреть файл

@ -13,6 +13,7 @@ using Foundation;
using CoreAnimation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreAnimation {
@ -26,8 +27,8 @@ namespace MonoTouchFixtures.CoreAnimation {
[Test]
public void AllBehaviorTypes ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
// turns out there's 2 undocumented behaviors: colorOverDistance and valueOverDistance
foreach (var type in CAEmitterBehavior.BehaviorTypes) {
@ -42,8 +43,8 @@ namespace MonoTouchFixtures.CoreAnimation {
[Test]
public void ColorOverDistance ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
// undocumented - we'll track it over the betas :)
using (var eb = CAEmitterBehavior.Create ((NSString) "colorOverDistance")) {
@ -62,8 +63,8 @@ namespace MonoTouchFixtures.CoreAnimation {
[Test]
public void ValueOverDistance ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
// undocumented - we'll track it over the betas :)
using (var eb = CAEmitterBehavior.Create ((NSString) "valueOverDistance")) {

Просмотреть файл

@ -19,6 +19,7 @@ using ObjCRuntime;
using UIKit;
#endif
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreBluetooth {
@ -81,7 +82,7 @@ namespace MonoTouchFixtures.CoreBluetooth {
//known UUID for a heart monitor, more common, we want to find something and make sure we do not crash
heartRateMonitorUUID = CBUUID.FromPartial (0x180D);
// Required API is available in macOS 10.8, but it doesn't work (hangs in 10.8-10.9, randomly crashes in 10.10) on the bots.
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 11, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 11, throwIfOtherPlatform: false);
mgrDelegate = new ManagerDelegate ();
mgr = new CBCentralManager (mgrDelegate, new DispatchQueue ("com.xamarin.tests." + TestContext.CurrentContext.Test.Name));
if (!mgrDelegate.PoweredOnEvent.WaitOne (TimeSpan.FromSeconds (5)))

Просмотреть файл

@ -13,6 +13,7 @@ using Foundation;
using CoreBluetooth;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreBluetooth {
@ -22,8 +23,8 @@ namespace MonoTouchFixtures.CoreBluetooth {
[Test]
public void Constructor ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 13, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 13, throwIfOtherPlatform: false);
// crash at dispose time in beta 4 (and 5)
// the type is undocumented but I think it's should be abstract (not user creatable)

Просмотреть файл

@ -21,6 +21,7 @@ using UIKit;
#endif
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreBluetooth {
@ -124,7 +125,7 @@ namespace MonoTouchFixtures.CoreBluetooth {
Assert.That (u1.GetHashCode (), Is.EqualTo (u2.GetHashCode ()), "GetHashCode-3");
}
#if MONOMAC
if (TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 10)) {
if (TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 10)) {
guid = new byte [] { 0xaa, 0xbb, 0xcc, 0xdd };
Assert.That (CBUUID.FromBytes (guid),
Is.EqualTo (CBUUID.FromBytes (guid)));
@ -162,7 +163,7 @@ namespace MonoTouchFixtures.CoreBluetooth {
Assert.That (u1.GetHashCode (), Is.EqualTo (u2.GetHashCode ()), "GetHashCode-3");
}
#if MONOMAC
if (TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 10)) {
if (TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 10)) {
Assert.That (CBUUID.FromBytes (new byte [] { 0xab, 0xcd, 0xef, 0x12 }),
Is.EqualTo (MakeFull (0xab, 0xcd, 0xef, 0x12)));
@ -175,7 +176,7 @@ namespace MonoTouchFixtures.CoreBluetooth {
[Test]
public void Equality_PartialsOfDifferentSizeNotEqual ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
#if MONOMAC
Assert.That (CBUUID.FromPartial (0x1234), Is.Not.EqualTo (
CBUUID.FromBytes (new byte [] { 0x12, 0x34, 0x56, 0x78 })));

Просмотреть файл

@ -12,6 +12,7 @@ using Foundation;
using CoreData;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreData {
@ -30,7 +31,7 @@ namespace MonoTouchFixtures.CoreData {
Assert.That (moc.RegisteredObjects.Count, Is.EqualTo ((nuint) 0), "RegisteredObjects");
Assert.False (moc.RetainsRegisteredObjects, "RetainsRegisteredObjects");
Assert.That (moc.StalenessInterval, Is.EqualTo (-1), "StalenessInterval");
if (TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 12, throwIfOtherPlatform: false))
if (TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 12, throwIfOtherPlatform: false))
Assert.Null (moc.UndoManager, "UndoManager");
else
Assert.NotNull (moc.UndoManager, "UndoManager");

Просмотреть файл

@ -13,6 +13,7 @@ using Foundation;
using CoreFoundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreFoundation
{
@ -24,8 +25,8 @@ namespace MonoTouchFixtures.CoreFoundation
[SetUp]
public void SetUp ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -13,6 +13,7 @@ using Foundation;
using CoreFoundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreFoundation {
@ -49,8 +50,8 @@ namespace MonoTouchFixtures.CoreFoundation {
[Test]
public void NotifyWithDispatchBlock ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
using (var dg = new DispatchGroup ()) {
var called = false;

Просмотреть файл

@ -18,6 +18,7 @@ using AppKit;
using UIKit;
#endif
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreFoundation
{
@ -86,8 +87,8 @@ namespace MonoTouchFixtures.CoreFoundation
[Test]
public void DispatchSync ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
using (var queue = new DispatchQueue ("DispatchSync")) {
var called = false;
@ -105,8 +106,8 @@ namespace MonoTouchFixtures.CoreFoundation
[Test]
public void DispatchBarrierSync ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
using (var queue = new DispatchQueue ("DispatchBarrierSync")) {
var called = false;
@ -124,8 +125,8 @@ namespace MonoTouchFixtures.CoreFoundation
[Test]
public void DispatchAsync ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
using (var queue = new DispatchQueue ("DispatchAsync")) {
var called = false;
@ -146,8 +147,8 @@ namespace MonoTouchFixtures.CoreFoundation
[Test]
public void DispatchBarrierAsync ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
using (var queue = new DispatchQueue ("DispatchBarrierAsync")) {
var called = false;

Просмотреть файл

@ -20,6 +20,7 @@ using UIKit;
#endif
using NUnit.Framework;
using System.Threading;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreFoundation {
@ -166,12 +167,12 @@ namespace MonoTouchFixtures.CoreFoundation {
{
var qname = "com.apple.root.default-priority";
#if __IOS__
if (TestRuntime.CheckSystemVersion (PlatformName.iOS, 8, 0))
if (TestRuntime.CheckSystemVersion (ApplePlatform.iOS, 8, 0))
qname = "com.apple.root.default-qos";
#elif __WATCHOS__ || __TVOS__
qname = "com.apple.root.default-qos";
#elif __MACOS__
if (TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 10))
if (TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 10))
qname = "com.apple.root.default-qos";
#endif
Assert.That (DispatchQueue.DefaultGlobalQueue.Label, Is.EqualTo (qname), "Default");
@ -231,7 +232,7 @@ namespace MonoTouchFixtures.CoreFoundation {
[Test]
public void GetGlobalQueue_QualityOfService ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
// values changes in OS versions (and even in arch) but we only want to make sure we get a valid string so the prefix is enough
Assert.True (DispatchQueue.GetGlobalQueue (DispatchQualityOfService.Default).Label.StartsWith ("com.apple.root."), "Default");

Просмотреть файл

@ -12,6 +12,7 @@ using Foundation;
using CoreFoundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreFoundation {
@ -55,12 +56,12 @@ namespace MonoTouchFixtures.CoreFoundation {
using (CFUrl url = CFUrl.FromFile ("/")) {
string value = "file://localhost/";
#if __IOS__
if (TestRuntime.CheckSystemVersion (PlatformName.iOS, 7, 0))
if (TestRuntime.CheckSystemVersion (ApplePlatform.iOS, 7, 0))
value = "file:///";
#elif __WATCHOS__ || __TVOS__
value = "file:///";
#elif __MACOS__
if (TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 9))
if (TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 9))
value = "file:///";
#endif

Просмотреть файл

@ -15,6 +15,7 @@ using UIKit;
using PlatformImage = UIKit.UIImage;
#endif
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreImage
{
@ -122,8 +123,8 @@ namespace MonoTouchFixtures.CoreImage
[Test]
public void CIKernel_BasicTest ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 11, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 11, throwIfOtherPlatform: false);
Exception ex = null;
var t = new Thread (() => {
@ -174,8 +175,8 @@ namespace MonoTouchFixtures.CoreImage
[Test]
public void CIKernel_TestFromPrograms ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 11, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 11, throwIfOtherPlatform: false);
CIKernel[] kernels =
CIKernel.FromProgramMultiple (

Просмотреть файл

@ -19,6 +19,7 @@ using CoreText;
using Foundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreImage {
@ -49,8 +50,8 @@ namespace MonoTouchFixtures.CoreImage {
[Test]
public void CustomFilterTest ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 11, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 11, throwIfOtherPlatform: false);
MyFilter filter = new MyFilter ();
Assert.NotNull (filter);
@ -76,8 +77,8 @@ namespace MonoTouchFixtures.CoreImage {
[Test]
public void ColorSpace ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
using (var f = new CIColorCubeWithColorSpace ()) {
Assert.Null (f.ColorSpace, "ColorSpace/default");

Просмотреть файл

@ -21,6 +21,7 @@ using UIKit;
#endif
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreImage {
@ -49,7 +50,7 @@ namespace MonoTouchFixtures.CoreImage {
[Test]
public void WithMetadataDefaults ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
var options = new CIImageInitializationOptionsWithMetadata ();
Assert.That (options.Dictionary.Count, Is.EqualTo ((nuint) 0), "Count");
@ -59,7 +60,7 @@ namespace MonoTouchFixtures.CoreImage {
[Test]
public void WithMetadataProperties ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
var suboptions = new CGImageProperties () {
ProfileName = "Xamarin"

Просмотреть файл

@ -22,6 +22,7 @@ using CoreImage;
using CoreGraphics;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreImage {
@ -32,14 +33,14 @@ namespace MonoTouchFixtures.CoreImage {
[Test]
public void EmptyImage ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
Assert.IsNull (CIImage.EmptyImage.Properties);
}
[Test]
public void InitializationWithCustomMetadata ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
string file = Path.Combine (NSBundle.MainBundle.ResourcePath, "basn3p08.png");
using (var dp = new CGDataProvider (file)) {
using (var img = CGImage.FromPNG (dp, null, false, CGColorRenderingIntent.Default)) {
@ -74,15 +75,15 @@ namespace MonoTouchFixtures.CoreImage {
[Test]
public void AreaHistogram ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
// validate that a null NSDictionary is correct (i.e. uses filter defaults)
using (var h = CIImage.EmptyImage.CreateByFiltering ("CIAreaHistogram", null)) {
// broken on simulator/64 bits on iOS9 beta 2 - radar 21564256 -> fixed in beta 4
var success = true;
#if __MACOS__
if (!TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 11))
if (!TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 11))
success = false;
#endif
if (success) {

Просмотреть файл

@ -14,6 +14,7 @@ using UIKit;
using CoreLocation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreLocation {
@ -24,7 +25,7 @@ namespace MonoTouchFixtures.CoreLocation {
[Test]
public void Ctor2 ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
using (var uuid = new NSUuid ("E2C56DB5-DFFB-48D2-B060-D0F5A71096E0"))
using (var br = new CLBeaconRegion (uuid, "identifier")) {
@ -43,7 +44,7 @@ namespace MonoTouchFixtures.CoreLocation {
[Test]
public void Ctor3 ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
using (var uuid = new NSUuid ("E2C56DB5-DFFB-48D2-B060-D0F5A71096E0"))
using (var br = new CLBeaconRegion (uuid, 0, "identifier")) {
@ -61,7 +62,7 @@ namespace MonoTouchFixtures.CoreLocation {
[Test]
public void Ctor4 ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
using (var uuid = new NSUuid ("E2C56DB5-DFFB-48D2-B060-D0F5A71096E0"))
using (var br = new CLBeaconRegion (uuid, 2, 3, "identifier")) {

Просмотреть файл

@ -3,6 +3,7 @@ using Foundation;
using CoreMedia;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreMedia
{
@ -15,7 +16,7 @@ namespace MonoTouchFixtures.CoreMedia
[Test]
public void RetainReleaseTest ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
var clock = CMClock.HostTimeClock;
var timebase = new CMClockOrTimebase (clock.Handle);

Просмотреть файл

@ -14,6 +14,7 @@ using CoreMedia;
using Foundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreMedia {
@ -39,7 +40,7 @@ namespace MonoTouchFixtures.CoreMedia {
[Test]
public void HostTimeClock ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
using (var clock = CMClock.HostTimeClock) {
Assert.That (clock.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle");

Просмотреть файл

@ -18,6 +18,7 @@ using AppKit;
using UIKit;
#endif
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreMedia {
@ -43,7 +44,7 @@ namespace MonoTouchFixtures.CoreMedia {
[Test]
public void Video ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
CMFormatDescriptionError fde;
@ -81,7 +82,7 @@ namespace MonoTouchFixtures.CoreMedia {
[Test]
public void RefcountTest ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
// Bug #27205

Просмотреть файл

@ -11,6 +11,7 @@ using Foundation;
using CoreMedia;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreMedia {
@ -21,7 +22,7 @@ namespace MonoTouchFixtures.CoreMedia {
[Test]
public void Ctor ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
using (var mp = new CMMemoryPool ())
{
@ -35,7 +36,7 @@ namespace MonoTouchFixtures.CoreMedia {
[Test]
public void CtorAgeOutPeriod ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
using (var mp = new CMMemoryPool (TimeSpan.FromSeconds (40)))
{

Просмотреть файл

@ -17,6 +17,7 @@ using AppKit;
using UIKit;
#endif
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreMedia {
@ -101,7 +102,7 @@ namespace MonoTouchFixtures.CoreMedia {
public void MultiplyByRatio ()
{
TestRuntime.AssertXcodeVersion (5, 1);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
var t = new CMTime (1000, 1);
t = CMTime.Multiply (t, 20, 10);

Просмотреть файл

@ -11,6 +11,7 @@ using Foundation;
using CoreMedia;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreMedia {
@ -22,7 +23,7 @@ namespace MonoTouchFixtures.CoreMedia {
[Test]
public void DefaultValues ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
var htc = CMClock.HostTimeClock;
using (var tb = new CMTimebase (htc)) {
@ -43,7 +44,7 @@ namespace MonoTouchFixtures.CoreMedia {
[Test]
public void SetAnchorTime ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
using (var tb = new CMTimebase (CMClock.HostTimeClock)) {
Assert.AreEqual (CMTimebaseError.None, tb.SetAnchorTime (new CMTime (1000000, 200), new CMTime (-1, -2)));
@ -55,7 +56,7 @@ namespace MonoTouchFixtures.CoreMedia {
[Test]
public void AddTimer ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
using (var tb = new CMTimebase (CMClock.HostTimeClock)) {
var timer = NSTimer.CreateRepeatingTimer (CMTimebase.VeryLongTimeInterval, delegate { });
@ -71,7 +72,7 @@ namespace MonoTouchFixtures.CoreMedia {
[Test]
public void GetMasterTests ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
using (var tb = new CMTimebase (CMClock.HostTimeClock)) {
var masterTB = tb.GetMasterTimebase ();
@ -92,7 +93,7 @@ namespace MonoTouchFixtures.CoreMedia {
[Test]
public void CopyMasterTests ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
using (var tb = new CMTimebase (CMClock.HostTimeClock)) {
var masterTB = tb.CopyMasterTimebase ();

Просмотреть файл

@ -15,6 +15,7 @@ using ObjCRuntime;
using CoreVideo;
using CoreMedia;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreMedia {
@ -41,8 +42,8 @@ namespace MonoTouchFixtures.CoreMedia {
[Test]
public void CreateReadyWithPacketDescriptions ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
CMBlockBufferError bbe;
using (var bb = CMBlockBuffer.CreateEmpty (0, CMBlockBufferFlags.AlwaysCopyData, out bbe)) {
@ -61,8 +62,8 @@ namespace MonoTouchFixtures.CoreMedia {
[Test]
public void CreateReady ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
CMBlockBufferError bbe;
using (var bb = CMBlockBuffer.CreateEmpty (0, CMBlockBufferFlags.AlwaysCopyData, out bbe)) {
@ -78,8 +79,8 @@ namespace MonoTouchFixtures.CoreMedia {
[Test]
public void CreateReadyWithImageBuffer_ArrayValidations ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
CMFormatDescriptionError fde;
using (var pixelBuffer = new CVPixelBuffer (20, 10, CVPixelFormatType.CV24RGB))
@ -96,8 +97,8 @@ namespace MonoTouchFixtures.CoreMedia {
[Test]
public void CreateReadyWithImageBuffer ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 8, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
CMFormatDescriptionError fde;
using (var pixelBuffer = new CVPixelBuffer (20, 10, CVPixelFormatType.CV24RGB))

Просмотреть файл

@ -6,6 +6,7 @@ using NUnit.Framework;
using Foundation;
using ObjCRuntime;
using CoreVideo;
using Xamarin.Utils;
namespace MonoTouchFixtures.CoreVideo {
@ -16,7 +17,7 @@ namespace MonoTouchFixtures.CoreVideo {
[Test]
public void CreateFromDisplayIdValidIdTest ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 12, 0);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 12, 0);
Assert.DoesNotThrow (() => {
using var displayLink = CVDisplayLink.CreateFromDisplayId ((uint) CGDisplay.MainDisplayID);
Assert.NotNull (displayLink, "Not null");
@ -27,7 +28,7 @@ namespace MonoTouchFixtures.CoreVideo {
[Test]
public void CreateFromDisplayWrongIdTest ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 12, 0);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 12, 0);
Assert.DoesNotThrow (() => {
using var displayLink = CVDisplayLink.CreateFromDisplayId (UInt32.MaxValue);
Assert.Null (displayLink, "null");
@ -37,7 +38,7 @@ namespace MonoTouchFixtures.CoreVideo {
[Test]
public void CreateFromDisplayIdsTest ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 12, 0);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 12, 0);
// we might not have more than one display, therefore we will use an array
// with a single one, there is nothing in the docs that say that we cannot do that
Assert.DoesNotThrow (() => {
@ -49,7 +50,7 @@ namespace MonoTouchFixtures.CoreVideo {
[Test]
public void CreateFromOpenGLMaskTest ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 12, 0);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 12, 0);
var openGLMask = CGDisplay.GetOpenGLDisplayMask (CGDisplay.MainDisplayID);
Assert.DoesNotThrow (() => {
using var displayLink = CVDisplayLink.CreateFromOpenGLMask ((uint) openGLMask);
@ -77,7 +78,7 @@ namespace MonoTouchFixtures.CoreVideo {
[Test]
public void GetTypeIdTest ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 12, 0);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 12, 0);
Assert.DoesNotThrow (() => {
CVDisplayLink.GetTypeId ();
}, "Throws");
@ -86,7 +87,7 @@ namespace MonoTouchFixtures.CoreVideo {
[Test]
public void TryTranslateTimeValidTest ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 12, 0);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 12, 0);
var outTime = new CVTimeStamp {
Version = 0,
Flags = (1L << 0) | (1L << 1), // kCVTimeStampVideoTimeValid | kCVTimeStampHostTimeValid

Просмотреть файл

@ -15,6 +15,7 @@ using CoreGraphics;
using EventKit;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.EventKit {
@ -25,7 +26,7 @@ namespace MonoTouchFixtures.EventKit {
[Test]
public void NullAllowedTest ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
using (var alarm = EKAlarm.FromTimeInterval (1234)) {
alarm.AbsoluteDate = null;

Просмотреть файл

@ -16,6 +16,7 @@ using CoreGraphics;
using ObjCRuntime;
using EventKit;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.EventKit {
@ -25,7 +26,7 @@ namespace MonoTouchFixtures.EventKit {
[SetUp]
public void Setup ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
}
void RequestPermission ()

Просмотреть файл

@ -14,6 +14,7 @@ using EventKit;
using Foundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.EventKit {
@ -24,7 +25,7 @@ namespace MonoTouchFixtures.EventKit {
[SetUp]
public void Setup ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
}
[Test]

Просмотреть файл

@ -14,6 +14,7 @@ using Foundation;
using EventKit;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.EventKit {
@ -25,7 +26,7 @@ namespace MonoTouchFixtures.EventKit {
[SetUp]
public void Setup ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
}
[Test]
@ -56,7 +57,7 @@ namespace MonoTouchFixtures.EventKit {
[Test]
public void Range ()
{
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
using (var rem = new EKReminder ()) {
// priority is documented to have a range of 0-9 but there's no validation in ObjC

Просмотреть файл

@ -14,6 +14,7 @@ using Foundation;
using ExternalAccessory;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.ExternalAccessory {
@ -43,7 +44,7 @@ namespace MonoTouchFixtures.ExternalAccessory {
public void ShowBluetoothAccessoryPicker ()
{
// The API here was introduced to Mac Catalyst later than for the other frameworks, so we have this additional check
TestRuntime.AssertSystemVersion (PlatformName.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacCatalyst, 14, 0, throwIfOtherPlatform: false);
EAAccessoryManager.SharedAccessoryManager.ShowBluetoothAccessoryPicker (null, null);
}
#endif

Просмотреть файл

@ -12,6 +12,7 @@ using ObjCRuntime;
#if !__WATCHOS__
using CoreText;
#endif
using Xamarin.Utils;
namespace MonoTouchFixtures.Foundation {
@ -84,8 +85,8 @@ namespace MonoTouchFixtures.Foundation {
[Test]
public void UIKitAttachmentConveniences_New ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 11, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 11, throwIfOtherPlatform: false);
// so we added custom code calling the (old) category helper - but we had to pick a different name
using (var ta = new NSTextAttachment (null, null))

Просмотреть файл

@ -2,6 +2,7 @@ using System;
using Foundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
using RectangleF=CoreGraphics.CGRect;
using SizeF=CoreGraphics.CGSize;
@ -90,7 +91,7 @@ namespace MonoTouchFixtures.Foundation {
case NSCalendarType.IslamicTabular:
case NSCalendarType.IslamicUmmAlQura:
#if __MACOS__
if (!TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 10))
if (!TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 10))
continue;
#else
if (!TestRuntime.CheckXcodeVersion (6, 0))
@ -220,7 +221,7 @@ namespace MonoTouchFixtures.Foundation {
public void TestAddingByComponents ()
{
RequiresIos8 ();
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
NSDate now = NSDate.Now;
NSDate oneDayFromNow = NSCalendar.CurrentCalendar.DateByAddingUnit (NSCalendarUnit.Day, 1, now, NSCalendarOptions.None);

Просмотреть файл

@ -10,6 +10,7 @@
using Foundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.Foundation {
@ -21,7 +22,7 @@ namespace MonoTouchFixtures.Foundation {
public void SetValueEnumArray ()
{
TestRuntime.AssertXcodeVersion (6, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
var encodings = new NSStringEncoding [] { NSStringEncoding.ISOLatin1, NSStringEncoding.ISOLatin2 };
var edo = new EncodingDetectionOptions () {

Просмотреть файл

@ -8,6 +8,7 @@ using AppKit;
using UIKit;
#endif
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.Foundation
{
@ -21,7 +22,7 @@ namespace MonoTouchFixtures.Foundation
void RequiresIos8 ()
{
TestRuntime.AssertXcodeVersion (6, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
if (dateComponentsFormatter == null)
dateComponentsFormatter = new NSDateComponentsFormatter ();

Просмотреть файл

@ -19,6 +19,7 @@ using AppKit;
using UIKit;
#endif
using NUnit.Framework;
using Xamarin.Utils;
using MonoTests.System.Net.Http;
@ -32,7 +33,7 @@ namespace MonoTouchFixtures.Foundation {
public void ConstructorTest ()
{
TestRuntime.AssertXcodeVersion (5, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
var bytes = Marshal.AllocHGlobal (1);
var deallocated = false;
@ -144,7 +145,7 @@ namespace MonoTouchFixtures.Foundation {
}
#endif
// Https seems broken on our macOS 10.9 bot, so skip this test.
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
// we have network issues, try several urls, if one works, be happy, else fail
for (var i = 0; i < NetworkResources.RobotsUrls.Length; i++) {
@ -165,7 +166,7 @@ namespace MonoTouchFixtures.Foundation {
public void Base64_Short ()
{
TestRuntime.AssertXcodeVersion (5, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
using (var data = NSData.FromArray (new byte [1] { 42 })) {
string s1 = data.GetBase64EncodedString (NSDataBase64EncodingOptions.EndLineWithCarriageReturn);
@ -186,7 +187,7 @@ namespace MonoTouchFixtures.Foundation {
public void Base64_Long ()
{
TestRuntime.AssertXcodeVersion (5, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
byte[] array = new byte [60];
using (var data = NSData.FromArray (array)) {
@ -337,7 +338,7 @@ namespace MonoTouchFixtures.Foundation {
public void Base64String ()
{
TestRuntime.AssertXcodeVersion (5, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
using (var d = new NSData ("WGFtYXJpbg==", NSDataBase64DecodingOptions.IgnoreUnknownCharacters)) {
Assert.That (d.ToString (), Is.EqualTo ("Xamarin"));
@ -348,7 +349,7 @@ namespace MonoTouchFixtures.Foundation {
public void Base64Data ()
{
TestRuntime.AssertXcodeVersion (5, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
using (var b = NSData.FromString ("WGFtYXJpbg=="))
using (var d = new NSData (b, NSDataBase64DecodingOptions.IgnoreUnknownCharacters)) {

Просмотреть файл

@ -5,6 +5,7 @@ using NUnit.Framework;
using Foundation;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.Foundation {
@ -212,7 +213,7 @@ namespace MonoTouchFixtures.Foundation {
public void IndexerTest ()
{
// This test doesn't work on Lion, because Lion returns mutable dictionaries in some places this test asserts that those dictionaries are non-mutable.
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
IntPtr strkeyptr = IntPtr.Zero;
IntPtr strobjptr = IntPtr.Zero;
IntPtr objptr;

Просмотреть файл

@ -5,6 +5,7 @@ using System.Reflection;
using Foundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
[assembly: Preserve (typeof (NSExpression), AllMembers = true)]
@ -227,7 +228,7 @@ namespace MonoTouchFixtures.Foundation
public void AnyKeyPropertiesTest ()
{
TestRuntime.AssertXcodeVersion (5, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
var availableProperties = new List<string> { };
using (var expression = NSExpression.FromAnyKey ()) {

Просмотреть файл

@ -11,6 +11,7 @@ using UIKit;
using Foundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.Foundation {
@ -22,7 +23,7 @@ namespace MonoTouchFixtures.Foundation {
[Test]
public void FromVisualFormat ()
{
TestRuntime.AssertSystemVersion (PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false);
using (var testViewController = new TestViewController ()) {
var constraints = NSLayoutConstraint.FromVisualFormat ("V:|[topLayoutGuide]-[firstLabel]-[secondLabel]",

Просмотреть файл

@ -2,6 +2,7 @@ using System.Collections.Generic;
using Foundation;
using ObjCRuntime;
using NUnit.Framework;
using Xamarin.Utils;
namespace monotouchtest
{
@ -39,7 +40,7 @@ namespace monotouchtest
testString.EnumerateLinguisticTags (range, NSLinguisticTagScheme.Token, NSLinguisticTaggerOptions.OmitWhitespace, null, Enumerator);
var expectedWordCount = 3;
#if __MACOS__
if (!TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 9))
if (!TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 9))
expectedWordCount = 4;
#endif
Assert.AreEqual (expectedWordCount, words.Count, "Word count: " + string.Join (", ", words));
@ -73,7 +74,7 @@ namespace monotouchtest
var tags = testString.GetLinguisticTags (range, NSLinguisticTagScheme.NameOrLexicalClass, NSLinguisticTaggerOptions.OmitWhitespace, null, out tokenRanges);
var expectedWordCount = 3;
#if __MACOS__
if (!TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 9))
if (!TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 9))
expectedWordCount = 4;
#endif
Assert.AreEqual (expectedWordCount, tags.Length, "Tags Length");

Просмотреть файл

@ -7,6 +7,7 @@ using NUnit.Framework;
using Foundation;
using ObjCRuntime;
using Xamarin.Utils;
namespace MonoTouchFixtures.Foundation {
@ -143,7 +144,7 @@ namespace MonoTouchFixtures.Foundation {
{
var isMutableCopy = false;
#if __MACOS__
if (!TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 8))
if (!TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 8))
isMutableCopy = true;
#endif
using (var k = new NSString ("key"))

Просмотреть файл

@ -25,6 +25,7 @@ using UIKit;
using PlatformException=Foundation.MonoTouchException;
#endif
using NUnit.Framework;
using Xamarin.Utils;
using RectangleF=CoreGraphics.CGRect;
using SizeF=CoreGraphics.CGSize;
@ -82,7 +83,7 @@ namespace MonoTouchFixtures.Foundation {
}
var hasSecAccessControl = TestRuntime.CheckXcodeVersion (6, 0);
#if __MACOS__
if (!TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 10))
if (!TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 10))
hasSecAccessControl = false;
#endif
if (hasSecAccessControl) {

Просмотреть файл

@ -23,6 +23,7 @@ using UIStringAttributes = AppKit.NSStringAttributes;
using UIKit;
#endif
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.Foundation {
@ -175,7 +176,7 @@ namespace MonoTouchFixtures.Foundation {
public void DrawingExtensions ()
{
TestRuntime.AssertXcodeVersion (5, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 11, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 11, throwIfOtherPlatform: false);
using (var s = new NSString ("foo")) {
NSStringDrawingOptions options = NSStringDrawingOptions.OneShot;

Просмотреть файл

@ -19,6 +19,7 @@ using UIKit;
using NUnit.Framework;
using MonoTouchFixtures.Security;
using Xamarin.Utils;
namespace MonoTouchFixtures.Foundation {
@ -44,7 +45,7 @@ namespace MonoTouchFixtures.Foundation {
Assert.Null (creds.Password, "Password");
var expectedPersistence = NSUrlCredentialPersistence.ForSession;
#if __MACOS__
if (!TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 8))
if (!TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 8))
expectedPersistence = (NSUrlCredentialPersistence) uint.MaxValue;
#endif
Assert.That (creds.Persistence, Is.EqualTo (expectedPersistence), "Persistence");
@ -63,7 +64,7 @@ namespace MonoTouchFixtures.Foundation {
Assert.Null (creds.Password, "Password");
var expectedPersistence = NSUrlCredentialPersistence.ForSession;
#if __MACOS__
if (!TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 8))
if (!TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 8))
expectedPersistence = (NSUrlCredentialPersistence)uint.MaxValue;
#endif
Assert.That (creds.Persistence, Is.EqualTo (expectedPersistence), "Persistence");

Просмотреть файл

@ -21,6 +21,7 @@ using UIKit;
using ObjCRuntime;
using NUnit.Framework;
using MonoTests.System.Net.Http;
using Xamarin.Utils;
namespace MonoTouchFixtures.Foundation {
@ -71,7 +72,7 @@ namespace MonoTouchFixtures.Foundation {
public void RegistrarTest ()
{
// Networking seems broken on our macOS 10.9 bot, so skip this test.
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 10, throwIfOtherPlatform: false);
Exception ex = null;
var done = new ManualResetEvent (false);
@ -131,7 +132,7 @@ namespace MonoTouchFixtures.Foundation {
public override void StartLoading ()
{
#if MONOMAC
if (TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 10)) {
if (TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 10)) {
if (State == 3)
State++;
} else {

Просмотреть файл

@ -17,6 +17,7 @@ using AppKit;
using UIKit;
#endif
using NUnit.Framework;
using Xamarin.Utils;
namespace MonoTouchFixtures.Foundation {
@ -28,7 +29,7 @@ namespace MonoTouchFixtures.Foundation {
public void BackgroundSessionConfiguration ()
{
TestRuntime.AssertXcodeVersion (5, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
// https://trello.com/c/F6cyUBFU/70-simple-background-transfer-bo-pang-block-by-an-system-invalidcastexception-in-nsurlsessionconfiguration-backgroundsessionconfigu
using (var session = NSUrlSessionConfiguration.BackgroundSessionConfiguration ("id")) {
@ -40,7 +41,7 @@ namespace MonoTouchFixtures.Foundation {
public void Default_Properties ()
{
TestRuntime.AssertXcodeVersion (5, 0);
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 9, throwIfOtherPlatform: false);
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 9, throwIfOtherPlatform: false);
var config = NSUrlSessionConfiguration.DefaultSessionConfiguration;
@ -87,7 +88,7 @@ namespace MonoTouchFixtures.Foundation {
var hasSharedContainerIdentifier = true;
#if __MACOS__
hasSharedContainerIdentifier = TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 10);
hasSharedContainerIdentifier = TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 10);
#else
hasSharedContainerIdentifier = TestRuntime.CheckXcodeVersion (6, 0);
#endif
@ -117,7 +118,7 @@ namespace MonoTouchFixtures.Foundation {
var hasProtocolClasses = true;
#if __MACOS__
hasProtocolClasses = TestRuntime.CheckSystemVersion (PlatformName.MacOSX, 10, 10);
hasProtocolClasses = TestRuntime.CheckSystemVersion (ApplePlatform.MacOSX, 10, 10);
#else
hasProtocolClasses = TestRuntime.CheckXcodeVersion (6, 0);
#endif

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше