public void ConvertToChar_ShouldBeSuccessful(Key key, string expected) { // act var result = VisibilityBehaviors.ConvertToChar(key); // assert result.ShouldBe(expected); }
public void ElementShouldBeVisible_IfInputIsAlphaNumeric(Key key, Visibility expected) { // arrange _addSymbolView.Setup(x => x.Visibility).Returns(Visibility.Collapsed); _addSymbolView.Setup(x => x.SetSymbol(It.Is <string>(s => s == ConvertToString(key)))); // act VisibilityBehaviors.DoShowWhenKeystroke(_addSymbolView.Object, key); // assert _addSymbolView.VerifySet(x => x.Visibility = expected); }
public void ShouldNotProcessIfKeystrokeIsNonAlphaNumeric(Key key) { // arrange _addSymbolView.Setup(x => x.Visibility).Returns(Visibility.Collapsed); _addSymbolView.Setup(x => x.SetSymbol(It.Is <string>(s => s == ConvertToString(key)))); // act VisibilityBehaviors.DoShowWhenKeystroke(_addSymbolView.Object, key); // assert _addSymbolView.VerifySet(x => x.Visibility = Visibility.Collapsed, Times.Never); _addSymbolView.VerifySet(x => x.Visibility = Visibility.Visible, Times.Never); }
private static string ConvertToString(Key key) { return(VisibilityBehaviors.ConvertToChar(key)); }