public void It_will_throw_when_text_writer_is_null() { HtmlClassFormatter formatter = new HtmlClassFormatter(); Exception ex = Record.Exception(() => formatter.WriteHeader(new StubStyleSheet(), new StubLanguage(), null)); Assert.IsType <ArgumentNullException>(ex); Assert.Equal("textWriter", ((ArgumentNullException)ex).ParamName); }
public void It_will_throw_when_language_is_null() { HtmlClassFormatter formatter = new HtmlClassFormatter(); Exception ex = Record.Exception(() => formatter.WriteHeader(new StubStyleSheet(), null, new StubTextWriter())); Assert.IsType<ArgumentNullException>(ex); Assert.Equal("language", ((ArgumentNullException)ex).ParamName); }
public void It_will_write_the_header_with_no_class_name_if_language_does_not_specify_one() { HtmlClassFormatter formatter = new HtmlClassFormatter(); StubStyleSheet stubStyleSheet = new StubStyleSheet { Name__getValue = "fnord", Styles__getValue = new StyleDictionary() }; StubLanguage stubLanguage = new StubLanguage { CssClassName_getValue = "" }; StubTextWriter stubTextWriter = new StubTextWriter(); formatter.WriteHeader(stubStyleSheet, stubLanguage, stubTextWriter); Assert.Equal("<div><pre>", stubTextWriter.Write__buffer.Trim()); }
public void It_will_write_the_language_name_into_the_header() { HtmlClassFormatter formatter = new HtmlClassFormatter(); StubStyleSheet stubStyleSheet = new StubStyleSheet { Name__getValue = "fnord", Styles__getValue = new StyleDictionary { } }; StubLanguage language = new StubLanguage { CssClassName_getValue = "fnord" }; StubTextWriter stubTextWriter = new StubTextWriter(); formatter.WriteHeader(stubStyleSheet, language, stubTextWriter); Assert.Equal("<div class=\"fnord\"><pre>", stubTextWriter.Write__buffer.Trim()); }
public void It_will_write_the_language_name_into_the_header() { HtmlClassFormatter formatter = new HtmlClassFormatter(); StubStyleSheet stubStyleSheet = new StubStyleSheet { Name__getValue = "fnord", Styles__getValue = new StyleDictionary { } }; StubLanguage language = new StubLanguage { CssClassName_getValue = "fnord" }; StubTextWriter stubTextWriter = new StubTextWriter(); formatter.WriteHeader(stubStyleSheet, language, stubTextWriter); Assert.Equal("<div class=\"fnord\"><pre>", stubTextWriter.Write__buffer); }
public void It_will_write_the_header_with_no_class_name_if_language_does_not_specify_one() { HtmlClassFormatter formatter = new HtmlClassFormatter(); StubStyleSheet stubStyleSheet = new StubStyleSheet { Name__getValue = "fnord", Styles__getValue = new StyleDictionary() }; StubLanguage stubLanguage = new StubLanguage { CssClassName_getValue = "" }; StubTextWriter stubTextWriter = new StubTextWriter(); formatter.WriteHeader(stubStyleSheet, stubLanguage, stubTextWriter); Assert.Equal("<div><pre>", stubTextWriter.Write__buffer); }