public void Constructor_StateBag() { TestTableStyle ts = new TestTableStyle(new StateBag()); Assert.IsNotNull(ts.StateBag, "StateBag"); DefaultProperties(ts); NullProperties(ts); }
public void FillStyleAttributes_Css_WithoutResolution() { CssStyleCollection css = GetCssCollection(); TestTableStyle ts = new TestTableStyle(); ts.BackImageUrl = "http://www.go-mono.com"; ts.Fill(css, null); Assert.AreEqual(1, css.Count, "Count"); Assert.AreEqual("http://www.go-mono.com", css["background-image"], "css[string]"); Assert.AreEqual("http://www.go-mono.com", css[HtmlTextWriterStyle.BackgroundImage], "css[HtmlTextWriterStyle]"); Assert.AreEqual("background-image:url(http://www.go-mono.com);", css.Value, "css.Value"); }
public void FillStyleAttributes_NotCss() { CssStyleCollection css = GetCssCollection(); TestTableStyle ts = new TestTableStyle(); ts.CellPadding = 1; ts.CellSpacing = 1; ts.GridLines = GridLines.Both; ts.HorizontalAlign = HorizontalAlign.Justify; ts.Fill(css, new TestResolutionService()); Assert.AreEqual(0, css.Count, "Count"); }
public void GridLines_VS() { TestTableStyle ts = new TestTableStyle(); ts.TrackVS(); ts.GridLines = GridLines.Both; object o = ts.SaveVS(); ts = new TestTableStyle(); ts.LoadVS(o); Assert.AreEqual(GridLines.Both, ts.GridLines, "GL"); }
public void CopyFrom_IsEmpty() { TestTableStyle c = new TestTableStyle(); TableStyle s = new TableStyle(); s.BorderWidth = Unit.Empty; c.CopyFrom(s); Assert.IsTrue(c.Empty, "A1"); s.GridLines = GridLines.Both; c.CopyFrom(s); Assert.IsFalse(c.Empty, "A2"); }
private void DefaultProperties(TestTableStyle ts) { Assert.AreEqual(0, ts.StateBag.Count, "ViewState.Count"); Assert.AreEqual(String.Empty, ts.BackImageUrl, "BackImageUrl"); Assert.AreEqual(-1, ts.CellPadding, "CellPadding"); Assert.AreEqual(-1, ts.CellSpacing, "CellSpacing"); // LAMESPEC: default is document to be GridLines.Both Assert.AreEqual(GridLines.None, ts.GridLines, "GridLines"); Assert.AreEqual(HorizontalAlign.NotSet, ts.HorizontalAlign, "HorizontalAlign"); Assert.AreEqual(0, ts.StateBag.Count, "ViewState.Count-2"); ts.Reset(); Assert.AreEqual(0, ts.StateBag.Count, "Reset"); }
private void NullProperties(TestTableStyle ts) { Assert.IsTrue(ts.Empty, "Empty"); ts.BackImageUrl = String.Empty; // doesn't accept null, see specific test Assert.AreEqual(String.Empty, ts.BackImageUrl, "BackImageUrl"); Assert.IsFalse(ts.Empty, "!Empty"); ts.CellPadding = -1; Assert.AreEqual(-1, ts.CellPadding, "CellPadding"); ts.CellSpacing = -1; Assert.AreEqual(-1, ts.CellSpacing, "CellSpacing"); ts.GridLines = GridLines.None; Assert.AreEqual(GridLines.None, ts.GridLines, "GridLines"); ts.HorizontalAlign = HorizontalAlign.NotSet; Assert.AreEqual(HorizontalAlign.NotSet, ts.HorizontalAlign, "HorizontalAlign"); Assert.AreEqual(5, ts.StateBag.Count, "ViewState.Count-1"); ts.Reset(); Assert.AreEqual(0, ts.StateBag.Count, "Reset"); Assert.IsTrue(ts.Empty, "Empty/Reset"); }
public void GridLines_VS () { TestTableStyle ts = new TestTableStyle (); ts.TrackVS (); ts.GridLines = GridLines.Both; object o = ts.SaveVS (); ts = new TestTableStyle (); ts.LoadVS (o); Assert.AreEqual (GridLines.Both, ts.GridLines, "GL"); }
public void MergeWith_Empty () { TestTableStyle ts = new TestTableStyle (); ts.MergeWith (new TableStyle ()); DefaultProperties (ts); }
public void CopyFrom_IsEmpty () { TestTableStyle c = new TestTableStyle (); TableStyle s = new TableStyle (); s.BorderWidth = Unit.Empty; c.CopyFrom (s); Assert.IsTrue (c.Empty, "A1"); s.GridLines = GridLines.Both; c.CopyFrom (s); Assert.IsFalse (c.Empty, "A2"); }
public void CopyFrom_Empty () { TestTableStyle ts = new TestTableStyle (); ts.CopyFrom (new TableStyle ()); DefaultProperties (ts); }
public void FillStyleAttributes_Css_WithResolution () { CssStyleCollection css = GetCssCollection (); TestTableStyle ts = new TestTableStyle (); ts.BackImageUrl = "http://www.go-mono.com"; ts.Fill (css, new TestResolutionService ()); Assert.AreEqual (1, css.Count, "Count"); Assert.AreEqual ("http://www.mono-project.com", css["background-image"], "css[string]"); Assert.AreEqual ("http://www.mono-project.com", css[HtmlTextWriterStyle.BackgroundImage], "css[HtmlTextWriterStyle]"); Assert.AreEqual ("background-image:url(http://www.mono-project.com);", css.Value, "css.Value"); Assert.AreEqual ("http://www.go-mono.com", ts.BackImageUrl, "BackImageUrl"); }
public void FillStyleAttributes_Empty () { CssStyleCollection css = GetCssCollection (); TestTableStyle ts = new TestTableStyle (); ts.Fill (css, new TestResolutionService ()); Assert.AreEqual (0, css.Count, "Count"); }
private void DefaultProperties (TestTableStyle ts) { Assert.AreEqual (0, ts.StateBag.Count, "ViewState.Count"); Assert.AreEqual (String.Empty, ts.BackImageUrl, "BackImageUrl"); Assert.AreEqual (-1, ts.CellPadding, "CellPadding"); Assert.AreEqual (-1, ts.CellSpacing, "CellSpacing"); // LAMESPEC: default is document to be GridLines.Both Assert.AreEqual (GridLines.None, ts.GridLines, "GridLines"); Assert.AreEqual (HorizontalAlign.NotSet, ts.HorizontalAlign, "HorizontalAlign"); Assert.AreEqual (0, ts.StateBag.Count, "ViewState.Count-2"); ts.Reset (); Assert.AreEqual (0, ts.StateBag.Count, "Reset"); }
public void FillStyleAttributes_Null_Resolver () { TestTableStyle ts = new TestTableStyle (); ts.Fill (null, new TestResolutionService ()); // no exception }
public void FillStyleAttributes_Css_Null () { TestTableStyle ts = new TestTableStyle (); ts.Fill (GetCssCollection (), null); // no exception }
private void NullProperties (TestTableStyle ts) { Assert.IsTrue (ts.Empty, "Empty"); ts.BackImageUrl = String.Empty; // doesn't accept null, see specific test Assert.AreEqual (String.Empty, ts.BackImageUrl, "BackImageUrl"); Assert.IsFalse (ts.Empty, "!Empty"); ts.CellPadding = -1; Assert.AreEqual (-1, ts.CellPadding, "CellPadding"); ts.CellSpacing = -1; Assert.AreEqual (-1, ts.CellSpacing, "CellSpacing"); ts.GridLines = GridLines.None; Assert.AreEqual (GridLines.None, ts.GridLines, "GridLines"); ts.HorizontalAlign = HorizontalAlign.NotSet; Assert.AreEqual (HorizontalAlign.NotSet, ts.HorizontalAlign, "HorizontalAlign"); Assert.AreEqual (5, ts.StateBag.Count, "ViewState.Count-1"); ts.Reset (); Assert.AreEqual (0, ts.StateBag.Count, "Reset"); Assert.IsTrue (ts.Empty, "Empty/Reset"); }
public void FillStyleAttributes_NotCss () { CssStyleCollection css = GetCssCollection (); TestTableStyle ts = new TestTableStyle (); ts.CellPadding = 1; ts.CellSpacing = 1; ts.GridLines = GridLines.Both; ts.HorizontalAlign = HorizontalAlign.Justify; ts.Fill (css, new TestResolutionService ()); Assert.AreEqual (0, css.Count, "Count"); }
public void Constructor_Default () { TestTableStyle ts = new TestTableStyle (); DefaultProperties (ts); NullProperties (ts); }
public void SetBitCalledWhenSetProperty () { TestTableStyle s = new TestTableStyle (); s.SetBitCalledFlag = false; s.BackImageUrl = "http://www.mono-project.com"; Assert.IsTrue (s.SetBitCalledFlag, "SetBit() was not called : BackImageUrl"); Assert.AreEqual (0x10000, s.SetBitCalledValue, "SetBit() was called with wrong argument : BackImageUrl"); s.SetBitCalledFlag = false; s.CellPadding = 1; Assert.IsTrue (s.SetBitCalledFlag, "SetBit() was not called : CellPadding"); Assert.AreEqual (0x20000, s.SetBitCalledValue, "SetBit() was called with wrong argument : CellPadding"); s.SetBitCalledFlag = false; s.CellSpacing = 1; Assert.IsTrue (s.SetBitCalledFlag, "SetBit() was not called : CellSpacing"); Assert.AreEqual (0x40000, s.SetBitCalledValue, "SetBit() was called with wrong argument : CellSpacing"); s.SetBitCalledFlag = false; s.GridLines = GridLines.Vertical; Assert.IsTrue (s.SetBitCalledFlag, "SetBit() was not called : GridLines"); Assert.AreEqual (0x80000, s.SetBitCalledValue, "SetBit() was called with wrong argument : GridLines"); s.SetBitCalledFlag = false; s.HorizontalAlign = HorizontalAlign.Right; Assert.IsTrue (s.SetBitCalledFlag, "SetBit() was not called : HorizontalAlign"); Assert.AreEqual (0x100000, s.SetBitCalledValue, "SetBit() was called with wrong argument : HorizontalAlign"); }
public void Constructor_StateBag () { TestTableStyle ts = new TestTableStyle (new StateBag ()); Assert.IsNotNull (ts.StateBag, "StateBag"); DefaultProperties (ts); NullProperties (ts); }