2016-08-09 15:11:44 +03:00
|
|
|
|
using System;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
#if XAMCORE_2_0
|
|
|
|
|
using Foundation;
|
|
|
|
|
using CloudKit;
|
2018-07-04 12:44:14 +03:00
|
|
|
|
using ObjCRuntime;
|
2016-08-09 15:11:44 +03:00
|
|
|
|
#else
|
|
|
|
|
using MonoTouch.Foundation;
|
|
|
|
|
using MonoTouch.CloudKit;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
namespace MonoTouchFixtures.CloudKit
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
[TestFixture]
|
|
|
|
|
[Preserve (AllMembers = true)]
|
|
|
|
|
public class CKFetchNotificationChangesOperationTest
|
|
|
|
|
{
|
|
|
|
|
CKServerChangeToken token = null;
|
|
|
|
|
CKFetchNotificationChangesOperation op = null;
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
|
public void SetUp ()
|
|
|
|
|
{
|
2016-09-01 06:08:54 +03:00
|
|
|
|
TestRuntime.AssertXcodeVersion (6, 0);
|
2018-07-04 12:44:14 +03:00
|
|
|
|
TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 10, 10, throwIfOtherPlatform: false);
|
2016-08-09 15:11:44 +03:00
|
|
|
|
op = new CKFetchNotificationChangesOperation (token);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TearDown]
|
|
|
|
|
public void TearDown ()
|
|
|
|
|
{
|
|
|
|
|
op?.Dispose ();
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-31 02:14:48 +03:00
|
|
|
|
[Test]
|
2016-08-09 15:11:44 +03:00
|
|
|
|
public void TestNotificationChangedSetter ()
|
|
|
|
|
{
|
|
|
|
|
op.NotificationChanged = (obj) => { Console.WriteLine ("Notification");};
|
|
|
|
|
Assert.NotNull (op.NotificationChanged);
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-31 02:14:48 +03:00
|
|
|
|
[Test]
|
2016-08-09 15:11:44 +03:00
|
|
|
|
public void TestCompletedSetter ()
|
|
|
|
|
{
|
|
|
|
|
op.Completed = (arg1, arg2) => { Console.WriteLine ("Completed");};
|
|
|
|
|
Assert.NotNull (op.Completed);
|
|
|
|
|
}
|
2016-08-31 02:14:48 +03:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void Default ()
|
|
|
|
|
{
|
|
|
|
|
// watchOS does not allow `init` so we need to ensure that our default .ctor
|
|
|
|
|
// match the existing `init*` with null values (so we can remove it)
|
|
|
|
|
using (var mrzo = new CKFetchNotificationChangesOperation ()) {
|
|
|
|
|
Assert.That (op.PreviousServerChangeToken, Is.EqualTo (mrzo.PreviousServerChangeToken), "PreviousServerChangeToken");
|
|
|
|
|
Assert.That (op.Completed, Is.EqualTo (mrzo.Completed), "Completed");
|
|
|
|
|
Assert.That (op.NotificationChanged, Is.EqualTo (mrzo.NotificationChanged), "NotificationChanged");
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-09 15:11:44 +03:00
|
|
|
|
}
|
|
|
|
|
}
|