コード例 #1
0
            public void ConvertBack()
            {
                RectangleResizeConverter rectangleResizeConverter = new RectangleResizeConverter();
                Rect   sourceRect         = new Rect(10, 10, 100, 100);
                double converterParameter = -10f;

                Assert.ThrowsException <NotImplementedException>(() => { rectangleResizeConverter.ConvertBack(sourceRect, typeof(Rect), converterParameter, new System.Globalization.CultureInfo("De")); });
            }
コード例 #2
0
            public void ConvertWrongParams()
            {
                RectangleResizeConverter rectangleResizeConverter = new RectangleResizeConverter();
                Rect   sourceRect         = new Rect(10, 10, 100, 100);
                string converterParameter = "HeyDiHo";

                Rect targetRect = (Rect)rectangleResizeConverter.Convert(sourceRect, typeof(Rect), converterParameter, new System.Globalization.CultureInfo("De"));

                Assert.AreEqual(default(Rect), targetRect);
            }
コード例 #3
0
            public void Convert()
            {
                RectangleResizeConverter rectangleResizeConverter = new RectangleResizeConverter();
                Rect   sourceRect         = new Rect(10, 10, 100, 100);
                double converterParameter = -10f;

                Rect targetRect = (Rect)rectangleResizeConverter.Convert(sourceRect, typeof(Rect), converterParameter, new System.Globalization.CultureInfo("De"));

                Assert.IsNotNull(targetRect);
                Assert.AreEqual(20, targetRect.X);
                Assert.AreEqual(20, targetRect.Y);
                Assert.AreEqual(80, targetRect.Width);
                Assert.AreEqual(80, targetRect.Height);
            }
コード例 #4
0
            public void Convert(string Parameter)
            {
                RectangleResizeConverter rectangleResizeConverter = new RectangleResizeConverter();
                Rectangle sourceRect = new Rectangle();

                sourceRect.Width  = 100;
                sourceRect.Height = 100;

                Rect targetRect = (Rect)rectangleResizeConverter.Convert(sourceRect, typeof(Rect), Parameter, new System.Globalization.CultureInfo("De"));

                Assert.IsNotNull(targetRect);
                Assert.AreEqual(10, targetRect.X);
                Assert.AreEqual(10, targetRect.Y);
                Assert.AreEqual(80, targetRect.Width);
                Assert.AreEqual(80, targetRect.Height);
            }