Beispiel #1
0
        public void Test_ConvertEmptyCollectionToVisibilityWithNegateTrue()
        {
            var converter = new EmptyCollectionToObjectConverter
            {
                NotEmptyValue = Visibility.Visible,
                EmptyValue    = Visibility.Collapsed
            };
            var result = converter.Convert(EmptyCollection, typeof(Visibility), "true", "en-us");

            Assert.AreEqual(Visibility.Visible, result);
        }
Beispiel #2
0
        public void Test_ConvertNullCollectionToVisibility()
        {
            var converter = new EmptyCollectionToObjectConverter
            {
                NotEmptyValue = Visibility.Visible,
                EmptyValue    = Visibility.Collapsed
            };
            var result = converter.Convert(NullCollection, typeof(Visibility), null, "en-us");

            Assert.AreEqual(Visibility.Collapsed, result);
        }
Beispiel #3
0
        public void Test_ConvertNotEmptyCollectionToBitmapImageWithTypeConversion()
        {
            var converter = new EmptyCollectionToObjectConverter
            {
                NotEmptyValue = "ms-appx:///Assets/NotEmptyCollection.png",
                EmptyValue    = "ms-appx:///Assets/EmptyCollection.png"
            };

            var result = converter.Convert(NotEmptyCollection, typeof(ImageSource), null, "en-us");

            Assert.IsInstanceOfType(result, typeof(BitmapImage));
            Assert.AreEqual(converter.NotEmptyValue, ((BitmapImage)result).UriSource.ToString());
        }
Beispiel #4
0
        public void Test_ConvertNotEmptyCollectionToBrushWithTypeConversion()
        {
            var converter = new EmptyCollectionToObjectConverter
            {
                NotEmptyValue = "Green",
                EmptyValue    = "Red"
            };

            var result = converter.Convert(NotEmptyCollection, typeof(Brush), null, "en-us");

            Assert.IsInstanceOfType(result, typeof(SolidColorBrush));
            Assert.AreEqual(Colors.Green, ((SolidColorBrush)result).Color);
        }
Beispiel #5
0
        public void Test_ConvertEmptyCollectionToBrush()
        {
            var greenBrush = new SolidColorBrush(Colors.Green);
            var redBrush   = new SolidColorBrush(Colors.Red);
            var converter  = new EmptyCollectionToObjectConverter
            {
                NotEmptyValue = greenBrush,
                EmptyValue    = redBrush
            };
            var result = converter.Convert(EmptyCollection, typeof(Brush), null, "en-us");

            Assert.AreEqual(redBrush, result);
        }