public void Convert_NotEquals_ReturnFalseValueProperty() { object obj = new object(); var falseValues = new object[] { true, false, null, Visibility.Visible, Visibility.Collapsed, "True", "", obj, Guid.NewGuid(), 0, 0.0, 0m, -1, -1.0, -1m, 1, 1.0, 1m, System.IO.SeekOrigin.Begin, System.IO.SeekOrigin.End, DateTime.MaxValue, new DateTime(), SystemColors.ActiveBorderColor, SystemColors.ActiveBorderBrush, DependencyProperty.UnsetValue }; var compareToValues = new object[] { true, false, null, Visibility.Visible, Visibility.Collapsed, "True", "", obj, Guid.NewGuid(), 0, 0.0, 0m, -1, -1.0, -1m, 1, 1.0, 1m, System.IO.SeekOrigin.Begin, System.IO.SeekOrigin.End, DateTime.MaxValue, new DateTime(), SystemColors.ActiveBorderColor, SystemColors.ActiveBorderBrush, DependencyProperty.UnsetValue }; var converterParameters = new object[] { true, false, null, Visibility.Visible, Visibility.Collapsed, "True", "", obj, Guid.NewGuid(), 0, 0.0, 0m, -1, -1.0, -1m, 1, 1.0, 1m, System.IO.SeekOrigin.Begin, System.IO.SeekOrigin.End, DateTime.MaxValue, new DateTime(), SystemColors.ActiveBorderColor, SystemColors.ActiveBorderBrush, DependencyProperty.UnsetValue }; var testParameters = from falseValue in falseValues from trueValue in falseValues from compareTo in compareToValues from converterParameter in converterParameters from isNegative in new[] { false, true } select new { trueValue, falseValue, compareTo, converterParameter, isNegative }; foreach (var testData in testParameters) { var sut = new EqualityConverter() { TrueValue = testData.trueValue, FalseValue = testData.falseValue, CompareTo = testData.compareTo, IsNegative = testData.isNegative }; var result = sut.Convert(new object(), typeof(object), testData.converterParameter, CultureInfo.CurrentCulture); Assert.AreEqual(testData.isNegative ? sut.TrueValue : sut.FalseValue, result); Assert.AreEqual(testData.isNegative ? testData.trueValue : testData.falseValue, result); } }
public void SetUp() { _converter = new EqualityConverter(); }
public static Visibility Convert(object item1, object item2) => EqualityConverter.Convert(item1, item2) ? Visibility.Visible : Visibility.Collapsed;