WriteHeader() публичный Метод

public WriteHeader ( IStyleSheet styleSheet, ILanguage language, TextWriter textWriter ) : void
styleSheet IStyleSheet
language ILanguage
textWriter System.IO.TextWriter
Результат void
Пример #1
0
            public void It_will_throw_when_style_sheet_is_null()
            {
                HtmlFormatter formatter = new HtmlFormatter();

                Exception ex = Record.Exception(() => formatter.WriteHeader(null, new StubLanguage(), new StubTextWriter()));

                Assert.IsType <ArgumentNullException>(ex);
                Assert.Equal("styleSheet", ((ArgumentNullException)ex).ParamName);
            }
            public void It_will_throw_when_text_writer_is_null()
            {
                HtmlFormatter formatter = new HtmlFormatter();

                Exception ex = Record.Exception(() => formatter.WriteHeader(new StubStyleSheet(), new StubLanguage(), null));

                Assert.IsType<ArgumentNullException>(ex);
                Assert.Equal("textWriter", ((ArgumentNullException)ex).ParamName);
            }
Пример #3
0
            public void It_will_write_the_header_without_the_plain_text_colors_if_they_are_not_in_the_style_sheet()
            {
                HtmlFormatter  formatter      = new HtmlFormatter();
                StubStyleSheet stubStyleSheet = new StubStyleSheet {
                    Name__getValue = "fnord", Styles__getValue = new StyleDictionary()
                };
                StubTextWriter stubTextWriter = new StubTextWriter();

                formatter.WriteHeader(stubStyleSheet, new StubLanguage(), stubTextWriter);

                Assert.Equal("<div><pre>", stubTextWriter.Write__buffer);
            }
Пример #4
0
            public void It_will_write_the_header_with_just_the_background_color_if_that_is_all_that_is_in_the_style_sheet()
            {
                HtmlFormatter  formatter      = new HtmlFormatter();
                StubStyleSheet stubStyleSheet = new StubStyleSheet {
                    Name__getValue = "fnord", Styles__getValue = new StyleDictionary {
                        new Style(ScopeName.PlainText)
                        {
                            Background = Color.White
                        }
                    }
                };
                StubTextWriter stubTextWriter = new StubTextWriter();

                formatter.WriteHeader(stubStyleSheet, new StubLanguage(), stubTextWriter);

                Assert.Equal("<div style=\"background-color:White;\"><pre>", stubTextWriter.Write__buffer);
            }
Пример #5
0
            public void It_will_write_the_header_using_the_plain_text_colors()
            {
                HtmlFormatter  formatter      = new HtmlFormatter();
                StubStyleSheet stubStyleSheet = new StubStyleSheet {
                    Name__getValue = "fnord", Styles__getValue = new StyleDictionary {
                        new Style(ScopeName.PlainText)
                        {
                            Background = Color.White, Foreground = Color.Black
                        }
                    }
                };
                StubTextWriter stubTextWriter = new StubTextWriter();

                formatter.WriteHeader(stubStyleSheet, new StubLanguage(), stubTextWriter);

                Assert.Equal("<div style=\"color:Black;background-color:White;\"><pre>", stubTextWriter.Write__buffer);
            }
            public void It_will_write_the_header_using_the_plain_text_colors()
            {
                HtmlFormatter formatter = new HtmlFormatter();
                StubStyleSheet stubStyleSheet = new StubStyleSheet { Name__getValue = "fnord", Styles__getValue = new StyleDictionary { new Style(ScopeName.PlainText) { Background = Color.White, Foreground = Color.Black } } };
                StubTextWriter stubTextWriter = new StubTextWriter();

                formatter.WriteHeader(stubStyleSheet, new StubLanguage(), stubTextWriter);

                Assert.Equal("<div style=\"color:Black;background-color:White;\"><pre>", stubTextWriter.Write__buffer);
            }
            public void It_will_write_the_header_with_just_the_foreground_color_if_that_is_all_that_is_in_the_style_sheet()
            {
                HtmlFormatter formatter = new HtmlFormatter();
                StubStyleSheet stubStyleSheet = new StubStyleSheet { Name__getValue = "fnord", Styles__getValue = new StyleDictionary { new Style(ScopeName.PlainText) { Foreground = Color.Black } } };
                StubTextWriter stubTextWriter = new StubTextWriter();

                formatter.WriteHeader(stubStyleSheet, new StubLanguage(), stubTextWriter);

                Assert.Equal("<div style=\"color:Black;\"><pre>", stubTextWriter.Write__buffer);
            }
            public void It_will_write_the_header_without_the_plain_text_colors_if_they_are_not_in_the_style_sheet()
            {
                HtmlFormatter formatter = new HtmlFormatter();
                StubStyleSheet stubStyleSheet = new StubStyleSheet { Name__getValue = "fnord", Styles__getValue = new StyleDictionary() };
                StubTextWriter stubTextWriter = new StubTextWriter();

                formatter.WriteHeader(stubStyleSheet, new StubLanguage(), stubTextWriter);

                Assert.Equal("<div><pre>", stubTextWriter.Write__buffer);
            }