예제 #1
0
        public void Error()
        {
            TestRuntime.AssertXcodeVersion(8, 0);

            NSError error;

            using (var d = new NSData()) {
                TestDelegate action = () => {
                    using (var s = HKCdaDocumentSample.Create(d, NSDate.DistantPast, NSDate.DistantFuture, (NSDictionary)null, out error)) {
                        Assert.NotNull(error, "error");
                        var details = new HKDetailedCdaErrors(error.UserInfo);
                        Assert.That(details.ValidationError.Length, Is.EqualTo((nint)0), "Length");
                    }
                };
#if __MACCATALYST__
                var throwsException = false;
#else
                var throwsException = TestRuntime.CheckXcodeVersion(11, 0);
#endif

                if (throwsException)
                {
                    var ex = Assert.Throws <MonoTouchException> (action, "Exception");
                    Assert.That(ex.Message, Does.Match("startDate.*and endDate.*exceed the maximum allowed duration for this sample type"), "Exception Message");
                }
                else
                {
                    action();
                }
            }
        }
        public void Error()
        {
            TestRuntime.AssertXcodeVersion(8, 0);

            NSError error;

            using (var d = new NSData())
                using (var s = HKCdaDocumentSample.Create(d, NSDate.DistantPast, NSDate.DistantFuture, (NSDictionary)null, out error)) {
                    Assert.NotNull(error, "error");
                    var details = new HKDetailedCdaErrors(error.UserInfo);
                    Assert.That(details.ValidationError.Length, Is.EqualTo(0), "Length");
                }
        }