public static NSAttributedString AttributedStringFor(string durationText, UIFont font) { var prefixLength = DurationHelper.LengthOfDurationPrefix(durationText); var result = new NSMutableAttributedString(durationText, font: font.GetMonospacedDigitFont(), foregroundColor: UIColor.Black); result.AddAttribute(UIStringAttributeKey.ForegroundColor, placeHolderColor, new NSRange(0, prefixLength)); return(result); }
public void CalculatesTheLengthOfPrefixCorrectly(string duration, int expectedPrefixLength) { var prefixLength = DurationHelper.LengthOfDurationPrefix(duration); prefixLength.Should().Be(expectedPrefixLength); }