public void LeftTest() { var hasFired = false; var length = new LengthDescriptor(33.3, LengthUnits.Percent); var selector = new CSSSelector("TEST"); selector.PropertyChanged += (sender, e) => { hasFired = e.PropertyName == "left"; }; selector.Left = length; Assert.IsTrue(hasFired); Assert.AreEqual(length, selector.Left); Assert.AreEqual(selector.HtmlCode, @"#TEST { position : relative; left : " + length.ToString() + @" } "); }
public void TopMethod() { var hasFired = false; var top = new LengthDescriptor(33.3, LengthUnits.Percent); var selector = new CSSSelector("TEST"); selector.PropertyChanged += (sender, e) => { hasFired = e.PropertyName == "top"; }; selector.Top = top; Assert.IsTrue(hasFired); Assert.AreEqual(top, selector.Top); Assert.AreEqual(selector.HtmlCode, @"#TEST { position : relative; top : " + top.ToString() + @" } "); }
public void HeightTest() { var hasFired = false; var size = new LengthDescriptor(33.3, LengthUnits.Percent); var selector = new CSSSelector("TEST"); selector.PropertyChanged += (sender, e) => { hasFired = e.PropertyName == "heigth"; }; selector.Height = size; Assert.IsTrue(hasFired); Assert.AreEqual(size, selector.Height); Assert.AreEqual(selector.HtmlCode, @"#TEST { position : relative; height : " + size.ToString() + @" } "); }
public void BottomMethod() { var hasFired = false; var length = new LengthDescriptor(33.3, LengthUnits.Percent); var selector = new CSSSelector("TEST"); var expectedText = String.Format("TEST {{{0}position : relative;{0}bottom : {1};{0}}}{0}", Environment.NewLine, length.ToString()); selector.PropertyChanged += (sender, e) => { hasFired = e.PropertyName == "bottom"; }; selector.Bottom = length; Assert.IsTrue(hasFired); Assert.AreEqual(length, selector.Bottom); Assert.AreEqual(selector.HtmlCode, expectedText); }