public void ShouldNotBeVisibleOnTrueReverseValue() { var converter = new VisibilityConverter(); Visibility result = (Visibility)converter.Convert(true, typeof(Visibility), "true", null); Assert.IsTrue(result == Visibility.Collapsed); }
public void ShouldBeVisibleOnFalseReverseValue() { var converter = new VisibilityConverter(); Visibility result = (Visibility)converter.Convert(false, typeof(Visibility), "true", null); Assert.IsTrue(result == Visibility.Visible); }
public void CollectionWithElementsIsVisible2() { var converter = new VisibilityConverter(); var result = converter.Convert(new string[] { "Test", "Test2", "Test3" }); Assert.AreEqual(Visibility.Visible, result); }
public void ZeroIntIsCollapsed() { var converter = new VisibilityConverter(); var result = converter.Convert(0); Assert.AreEqual(Visibility.Collapsed, result); }
public void StringIsVisible() { var converter = new VisibilityConverter(); var result = converter.Convert("test"); Assert.AreEqual(Visibility.Visible, result); }
public void EmptyCollectionIsCollapsed3() { var converter = new VisibilityConverter(); var result = converter.Convert(new Dictionary <string, string>()); Assert.AreEqual(Visibility.Collapsed, result); }
public void TrueIsVisible() { var converter = new VisibilityConverter(); var result = converter.Convert(true); Assert.AreEqual(Visibility.Visible, result); }
public void RandomIntIsVisible() { var converter = new VisibilityConverter(); var result = converter.Convert(56); Assert.AreEqual(Visibility.Visible, result); }
public void EmptyStringIsCollapsed() { var converter = new VisibilityConverter(); var result = converter.Convert(String.Empty); Assert.AreEqual(Visibility.Collapsed, result); }
public void RandomObjectIsVisible() { var converter = new VisibilityConverter(); var result = converter.Convert(Colors.Aqua); Assert.AreEqual(Visibility.Visible, result); }
public void EmptyArrayIsNotCollapsed() { var converter = new VisibilityConverter(); var result = converter.Convert(new string[7]); Assert.AreEqual(Visibility.Visible, result); }
public void FalseIsCollapsed() { var converter = new VisibilityConverter(); var result = converter.Convert(false); Assert.AreEqual(Visibility.Collapsed, result); }
public void RandomAnonymousObjectIsVisible() { var converter = new VisibilityConverter(); var result = converter.Convert(new { Test = "test" }); Assert.AreEqual(Visibility.Visible, result); }
/// <summary> Initializes a new instance of the <see cref="Binding" /> class with an initial path and /// with additional /// <see cref="Binding.ValidatesOnDataErrors"/>, /// <see cref="Binding.ValidatesOnExceptions"/> and /// <see cref="Binding.UpdateSourceTrigger"/> /// set to <c>true</c>. /// </summary> /// <param name="path">The initial <see cref="System.Windows.Data.Binding.Path" /> for the binding.</param> /// <param name="expression"> </param> /// <param name="compareValue"> </param> public VisibilityBinding(string path, VisibilityConverter.Expression expression, object compareValue) : base(path) { Mode = BindingMode.OneWay; Converter = VisibilityConverter.Get(expression); ConverterParameter = new VisibilityConverterParameter { CompareValue = compareValue }; }
public void TestObjectNotNull() { object input = new VisibilityConverter(); VisibilityConverter converter = new VisibilityConverter(); Visibility result = (Visibility)converter.Convert(input, typeof(Visibility), null, null); Assert.AreEqual(Visibility.Visible, result); }
public void TestStringNull() { string input = null; VisibilityConverter converter = new VisibilityConverter(); Visibility result = (Visibility)converter.Convert(input, typeof(Visibility), null, null); Assert.AreEqual(Visibility.Collapsed, result); }
public void TestString() { var input = "test"; VisibilityConverter converter = new VisibilityConverter(); Visibility result = (Visibility)converter.Convert(input, typeof(Visibility), null, null); Assert.AreEqual(Visibility.Visible, result); }
public void TestInt0() { var input = 0; VisibilityConverter converter = new VisibilityConverter(); Visibility result = (Visibility)converter.Convert(input, typeof(Visibility), null, null); Assert.AreEqual(Visibility.Collapsed, result); }
public void TestVisibiliyVisible() { Visibility input = Visibility.Visible; VisibilityConverter converter = new VisibilityConverter(); Visibility result = (Visibility)converter.Convert(input, typeof(Visibility), null, null); Assert.AreEqual(Visibility.Visible, result); }
public void CollectionWithElementsIsVisible3() { var converter = new VisibilityConverter(); var result = converter.Convert(new Dictionary <string, int> { { "Test", 5 } }); Assert.AreEqual(Visibility.Visible, result); }
public void TestEmptyIntCollection() { IEnumerable <int> input = new List <int>(); VisibilityConverter converter = new VisibilityConverter(); Visibility result = (Visibility)converter.Convert(input, typeof(Visibility), null, null); Assert.AreEqual(Visibility.Collapsed, result); }
public void EmptyStringNotSupportedIsVisible() { var converter = new VisibilityConverter() { SupportIsNullOrEmpty = false }; var result = converter.Convert(String.Empty); Assert.AreEqual(Visibility.Visible, result); }
public void NullStringNotSupportedIsCollapsed() { var converter = new VisibilityConverter() { SupportIsNullOrEmpty = false }; var result = converter.Convert(null); Assert.AreEqual(Visibility.Collapsed, result); }
public void EmptyCollectionNotSupportedIsVisible() { var converter = new VisibilityConverter() { SupportCollectionEmpty = false }; var result = converter.Convert(new List <string>()); Assert.AreEqual(Visibility.Visible, result); }
public void InverseStringIsCollapsed() { var converter = new VisibilityConverter() { Inverse = true }; var result = converter.Convert("test"); Assert.AreEqual(Visibility.Collapsed, result); }
public void InverseEmptyStringIsVisible() { var converter = new VisibilityConverter() { Inverse = true }; var result = converter.Convert(String.Empty); Assert.AreEqual(Visibility.Visible, result); }
public void InverseEmptyCollectionIsVisible() { var converter = new VisibilityConverter() { Inverse = true }; var result = converter.Convert(new List <string>()); Assert.AreEqual(Visibility.Visible, result); }
public void InverseRandomIntIsCollapsed() { var converter = new VisibilityConverter() { Inverse = true }; var result = converter.Convert(56); Assert.AreEqual(Visibility.Collapsed, result); }
public void InverseNullIsVisible() { var converter = new VisibilityConverter() { Inverse = true }; var result = converter.Convert(null); Assert.AreEqual(Visibility.Visible, result); }
public void Convert_TrueToVisible() { // Arrange var systemUnderTest = new VisibilityConverter(); // Act var result = systemUnderTest.Convert(true, null, null, null); // Assert Assert.AreEqual(result, Visibility.Visible); }