public void ShouldApplyBackgroundFromStyle() { // Given dynamic style = new DynamicWrapper(); style.Name = "style1"; style.Background = "Green"; dynamic elementMetadata = new DynamicWrapper(); elementMetadata.Text = "Some Text"; elementMetadata.Style = "style1"; // When var element = BuildTestHelper.BuildRun((object)elementMetadata, c => { c.PrintViewStyles = new Dictionary <string, object> { { "style1", style } }; }); // Then Assert.IsNotNull(element); Assert.AreEqual(PrintElementColors.Green, element.Background); }
public void ShouldApplyTextDecorationFromStyle() { // Given dynamic style = new DynamicWrapper(); style.Name = "style1"; style.TextDecoration = "Underline"; dynamic elementMetadata = new DynamicWrapper(); elementMetadata.Text = "Some Text"; elementMetadata.Style = "style1"; // When var element = BuildTestHelper.BuildRun((object)elementMetadata, c => { c.PrintViewStyles = new Dictionary <string, object> { { "style1", style } }; }); // Then Assert.IsNotNull(element); Assert.AreEqual(PrintElementTextDecoration.Underline, element.TextDecoration); }
public void ShouldApplyFontFromStyle() { // Given dynamic style = new DynamicWrapper(); style.Name = "style1"; style.Font = new DynamicWrapper(); style.Font.Family = "Arial"; style.Font.Size = 12; style.Font.SizeUnit = "Px"; style.Font.Style = "Italic"; style.Font.Stretch = "UltraExpanded"; style.Font.Weight = "Bold"; style.Font.Variant = "Subscript"; dynamic elementMetadata = new DynamicWrapper(); elementMetadata.Text = "Some Text"; elementMetadata.Style = "style1"; // When var element = BuildTestHelper.BuildRun((object)elementMetadata, c => { c.PrintViewStyles = new Dictionary <string, object> { { "style1", style } }; }); // Then Assert.IsNotNull(element); Assert.AreEqual("Arial", element.Font.Family); Assert.AreEqual(12, element.Font.Size); Assert.AreEqual(PrintElementFontStyle.Italic, element.Font.Style); Assert.AreEqual(PrintElementFontStretch.UltraExpanded, element.Font.Stretch); Assert.AreEqual(PrintElementFontWeight.Bold, element.Font.Weight); Assert.AreEqual(PrintElementFontVariant.Subscript, element.Font.Variant); }