public void CanCreateNewHtmlTextWriter() { HtmlTextWriter writer = MockRenderer.CreateHtmlTextWriter(); Assert.IsNotNull(writer, "Unable to create HtmlTextWriter"); Assert.IsInstanceOfType(typeof(StringWriter), writer.InnerWriter, "HtmlTextWriter's inner writer is not StringWriter"); }
public void SetsCustomAttributes() { control.Attributes["someattrib"] = "somevalue"; control.Attributes["someotherattrib"] = null; MockRenderer.AddDefautAttributesToCollection(control, attributes); Assert.AreEqual("somevalue", attributes["someattrib"], "custom attribute with string value not set"); Assert.IsNull(attributes["someotherattrib"], "custom attribute with null value improperly set"); }
public void InvokesRenderOnRendererWhenRenderIsInvoked() { var gameObject = new GameObject(); var mockRenderer = new MockRenderer(); gameObject.AddComponent(mockRenderer); gameObject.Render(new DummyGameTime()); Assert.IsTrue(mockRenderer.RenderWasInvoked); }
public void SetsColor() { control.ForeColor = Color.Empty; MockRenderer.AddDefautAttributesToCollection(control, attributes); Assert.IsNull(attributes.CssStyle["color"], "color improperly set when undefined"); control.ForeColor = Color.Black; MockRenderer.AddDefautAttributesToCollection(control, attributes); Assert.AreEqual(ColorTranslator.ToHtml(control.ForeColor), attributes.CssStyle["color"], "color not set"); }
public void SetsBorderWidth() { control.BorderWidth = Unit.Empty; MockRenderer.AddDefautAttributesToCollection(control, attributes); Assert.IsNull(attributes.CssStyle["border-width"], "border-width improperly set when undefined"); control.BorderWidth = new Unit(1.0, UnitType.Em); MockRenderer.AddDefautAttributesToCollection(control, attributes); Assert.AreEqual(control.BorderWidth.ToString(), attributes.CssStyle["border-width"], "border-width not set"); }
public void SetsBorderStyle() { control.BorderStyle = BorderStyle.NotSet; MockRenderer.AddDefautAttributesToCollection(control, attributes); Assert.IsNull(attributes.CssStyle["border-style"], "border-style improperly set when undefined"); control.BorderStyle = BorderStyle.Dotted; MockRenderer.AddDefautAttributesToCollection(control, attributes); Assert.AreEqual(control.BorderStyle.ToString().ToLowerInvariant(), attributes.CssStyle["border-style"], "border-style not set"); }
public void SetsHeight() { control.Height = Unit.Empty; MockRenderer.AddDefautAttributesToCollection(control, attributes); Assert.IsNull(attributes.CssStyle["height"], "height improperly set when undefined"); control.Height = new Unit(1.0, UnitType.Em); MockRenderer.AddDefautAttributesToCollection(control, attributes); Assert.AreEqual(control.Height.ToString(), attributes.CssStyle["height"], "height not set"); }
public void WritesAttributesProperly() { control.BackColor = Color.Black; control.Attributes["someattrib"] = "somevalue"; MockRenderer.AddDefautAttributesToCollection(control, attributes); HtmlTextWriter writer = new HtmlTextWriter(new System.IO.StringWriter()); MockRenderer.WriteAttributes(writer, attributes); Assert.AreEqual(" style=\"background-color:Black;\" someattrib=\"somevalue\"", writer.InnerWriter.ToString()); }
public void WritesStylesProperly() { control.BackColor = Color.Black; control.ForeColor = Color.White; MockRenderer.AddDefautAttributesToCollection(control, attributes); HtmlTextWriter writer = new HtmlTextWriter(new System.IO.StringWriter()); MockRenderer.WriteStyles(writer, attributes.CssStyle); Assert.AreEqual(" style=\"background-color:Black;color:White;\"", writer.InnerWriter.ToString()); }
public void ConcatenateCssClassTests() { //normal Assert.AreEqual("test1 test2 test3", MockRenderer.ConcatenateCssClasses("test1", "test2", "test3"), "CSS classes not properly concatenated"); //with spaces Assert.AreEqual(" test1 test2 test3 ", MockRenderer.ConcatenateCssClasses(" test1 ", " test2", "test3 "), "CSS classes not properly concatenated"); //null strings Assert.AreEqual("test1 test3", MockRenderer.ConcatenateCssClasses("test1", null, "test3"), "CSS classes not properly concatenated"); //empty strings Assert.AreEqual("test2", MockRenderer.ConcatenateCssClasses(String.Empty, "test2", ""), "CSS classes not properly concatenated"); }
public void InitializeMocks() { mockRenderer = new MockRenderer(); mockInputMethod = new MockInputMethod(); }