public void StopEnumerateSubstringsInRangeTest() { var testString = new NSString("Hello Hola Bonjour!"); var range = new NSRange(0, testString.Length - 1); testString.EnumerateLinguisticTags(range, NSLinguisticTagScheme.Token, NSLinguisticTaggerOptions.OmitWhitespace, null, StopEnumerator); Assert.AreEqual(1, words.Count, "Word count"); #if XAMCORE_4_0 Assert.True(words.Contains(NSLinguisticTag.Word.GetConstant()), "Token type."); #else Assert.True(words.Contains(NSLinguisticTagUnit.Word.GetConstant()), "Token type."); #endif }
public void EnumerateSubstringsInRangeTest() { var testString = new NSString("Hello Hola Bonjour!"); var range = new NSRange(0, testString.Length - 1); testString.EnumerateLinguisticTags(range, NSLinguisticTagScheme.Token, NSLinguisticTaggerOptions.OmitWhitespace, null, Enumerator); var expectedWordCount = 3; #if __MACOS__ if (!TestRuntime.CheckSystemVersion(PlatformName.MacOSX, 10, 9)) { expectedWordCount = 4; } #endif Assert.AreEqual(expectedWordCount, words.Count, "Word count: " + string.Join(", ", words)); #if XAMCORE_4_0 Assert.True(words.Contains(NSLinguisticTag.Word.GetConstant()), "Token type."); #else Assert.True(words.Contains(NSLinguisticTagUnit.Word.GetConstant()), "Token type."); #endif }