public void Should_Throw_If_LogFileContent_Is_WhiteSpace() { // Given / When var result = Record.Exception(() => MarkdownlintSettings.FromContent(" ")); // Then result.IsArgumentOutOfRangeException("logFileContent"); }
public void Should_Throw_If_LogFileContent_Is_Null() { // Given / When var result = Record.Exception(() => MarkdownlintSettings.FromContent(null)); // Then result.IsArgumentNullException("logFileContent"); }
public void Should_Throw_If_Log_Is_Null() { // Given / When var result = Record.Exception(() => new MarkdownlintProvider( null, MarkdownlintSettings.FromContent("Foo"))); // Then result.IsArgumentNullException("log"); }
public void Should_Set_Property_Values_Passed_To_Constructor() { // Given const string logFileContent = "foo"; // When var settings = MarkdownlintSettings.FromContent(logFileContent); // Then settings.LogFileContent.ShouldBe(logFileContent); }
public MarkdownlintProviderFixture(string fileResourceName) { this.Log = new FakeLog { Verbosity = Verbosity.Normal }; using (var stream = this.GetType().Assembly.GetManifestResourceStream("Cake.Prca.Issues.Markdownlint.Tests.Testfiles." + fileResourceName)) { using (var sr = new StreamReader(stream)) { this.Settings = MarkdownlintSettings.FromContent( sr.ReadToEnd()); } } this.PrcaSettings = new ReportCodeAnalysisIssuesToPullRequestSettings(@"c:\Source\Cake.Prca"); }
public void Should_Read_File_From_Disk() { var fileName = Path.GetTempFileName(); try { // Given string expected; using (var ms = new MemoryStream()) using (var stream = this.GetType().Assembly.GetManifestResourceStream("Cake.Prca.Issues.Markdownlint.Tests.Testfiles.markdownlint.json")) { stream.CopyTo(ms); var data = ms.ToArray(); using (var file = new FileStream(fileName, FileMode.Create, FileAccess.Write)) { file.Write(data, 0, data.Length); } expected = ConvertFromUtf8(data); } // When var settings = MarkdownlintSettings.FromFilePath(fileName); // Then settings.LogFileContent.ShouldBe(expected); } finally { if (File.Exists(fileName)) { File.Delete(fileName); } } }