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")); }); }
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); }
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); }
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); }