[monotouch-tests] Fix HK tests on sonoma. (#19446)

Before this commit we had the following failing test:

```
Error: Exception Message
Expected: String matching "Objective-C exception thrown. Name: _HKObjectValidationFailureException Reason: Type HKSample can not have endDate of NSDate.distantFuture"
But was: "Objective-C exception thrown. Name: _HKObjectValidationFailureException Reason: startDate (0001-01-01 00:00:00 +0000) and endDate (4001-01-01 00:00:00 +0000) exceed the maximum allowed duration for this sample type. Maximum duration for type
```

The new exception does not happen on macOS but does on iOS.
This commit is contained in:
Manuel de la Pena 2023-11-14 11:15:13 -05:00 коммит произвёл GitHub
Родитель f9ba5467e8
Коммит 9d259a539d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 5 добавлений и 0 удалений

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

@ -57,11 +57,16 @@ namespace MonoTouchFixtures.HealthKit {
#else
var ex = Assert.Throws<MonoTouchException> (action, "Exception");
#endif
#if MONOMAC
Assert.That (ex.Message, Does.Match ("startDate.*and endDate.*exceed the maximum allowed duration for this sample type"), "Exception Message");
#else
if (TestRuntime.CheckXcodeVersion (15, 0)) {
Assert.That (ex.Message, Does.Match ("Objective-C exception thrown. Name: _HKObjectValidationFailureException Reason: Type HKSample can not have endDate of NSDate.distantFuture"), "Exception Message");
} else {
Assert.That (ex.Message, Does.Match ("startDate.*and endDate.*exceed the maximum allowed duration for this sample type"), "Exception Message");
}
#endif
} else {
action ();
}