public void ShouldChangeText_NullResponderAndOldText_ReturnsExpectedResult(UIResponder responder, string oldText) { var filter = new ForbiddenCharsFilter('%'); var result = filter.ShouldChangeText(responder, oldText, new NSRange(1, 1), "new"); Assert.True(result); }
public async Task ShouldChangeText_UITextFieldForbiddenChars_ReturnsExpectedResult( string forbiddenChars, string oldText, string newText, bool expectedResult) { var result = await Helpers.RunOnUIThreadAsync(() => { var textField = new UITextField(); var range = new NSRange(oldText.Length - 1, newText.Length); var chars = forbiddenChars.ToCharArray(); var filter = new ForbiddenCharsFilter(chars); return(filter.ShouldChangeText(textField, oldText, range, newText)); }); Assert.Equal(expectedResult, result); }