public void Defaults() { TestRuntime.AssertXcodeVersion(4, 5); // this is yet another case where Apples plays ping-ping with different versions // // newsflash: iOS 8.1 says it's available but won't let you create a PKPassLibrary instance #24747 // but iOS 8.2 (first beta) on an iPad let's you do it // and final iOS 8.2 does not seems to return true anymore #28711 while 8.3 beta works !?! if (!PKPassLibrary.IsAvailable) { Assert.Inconclusive("PassKit is not available"); } var library = new PKPassLibrary(); // not null (but empty by default) and there's no API to add them Assert.NotNull(library.GetPasses(), "GetPasses"); // and we can't trick the OS to do it for us using (NSUrl url = new NSUrl(NSBundle.MainBundle.BundleUrl + "/BoardingPass.pkpass")) { #if !__WATCHOS__ Assert.False(UIApplication.SharedApplication.OpenUrl(url), "OpenUrl"); #endif } Assert.Null(library.GetPass(String.Empty, String.Empty), "GetPass"); using (var pass = PassTest.GetBoardingPass()) { Assert.False(library.Contains(pass), "Contains"); Assert.False(library.Replace(pass), "Replace"); library.Remove(pass); } }
public void BoardingPass() { if (UIDevice.CurrentDevice.UserInterfaceIdiom != UIUserInterfaceIdiom.Phone) { Assert.Inconclusive("PassKit does not work on iPads"); } using (var pass = PassTest.GetBoardingPass()) using (var ctrl = new PKAddPassesViewController(pass)) { ctrl.Finished += delegate { }; // not available on iPad... Assert.True((ctrl.Delegate != null) == PKPassLibrary.IsAvailable, "Delegate"); Assert.True((ctrl.WeakDelegate != null) == PKPassLibrary.IsAvailable, "WeakDelegate"); } }