public static nfloat SlackPointSizeDifference(string category) { switch (UIContentSizeCategoryExtensions.GetValue((NSString)category)) { case UIContentSizeCategory.ExtraSmall: return(-3.0f); case UIContentSizeCategory.Small: return(-2.0f); case UIContentSizeCategory.Medium: return(-1.0f); case UIContentSizeCategory.Large: return(0.0f); case UIContentSizeCategory.ExtraLarge: return(2.0f); case UIContentSizeCategory.ExtraExtraLarge: return(4.0f); case UIContentSizeCategory.ExtraExtraExtraLarge: return(6.0f); case UIContentSizeCategory.AccessibilityMedium: return(8.0f); case UIContentSizeCategory.AccessibilityLarge: return(10.0f); case UIContentSizeCategory.AccessibilityExtraLarge: return(11.0f); case UIContentSizeCategory.AccessibilityExtraExtraLarge: return(12.0f); case UIContentSizeCategory.AccessibilityExtraExtraExtraLarge: return(13.0f); case UIContentSizeCategory.Unspecified: default: return(0); } }
public void Compare() { var small = UIContentSizeCategory.Small; var large = UIContentSizeCategory.Large; Assert.True(UIContentSizeCategoryExtensions.Compare(small, large) == NSComparisonResult.Ascending, "small < large"); Assert.Throws <ArgumentException> (() => UIContentSizeCategoryExtensions.Compare((UIContentSizeCategory)31415, large)); Assert.Throws <ArgumentException> (() => UIContentSizeCategoryExtensions.Compare(small, (UIContentSizeCategory)271828)); Assert.Throws <ArgumentException> (() => ((UIContentSizeCategory)1234).IsAccessibilityCategory()); }