public async Task ReturnsOriginalDocumentForMissingSidecarFile() { // Given Engine engine = new Engine(); TestExecutionContext context = GetExecutionContext(engine); TestDocument[] inputs = { GetDocument("a/1.md", "File a1") }; bool executedSidecarModules = false; ProcessSidecarFile sidecar = new ProcessSidecarFile(".foo", new ExecuteConfig(Config.FromDocument(x => { executedSidecarModules = true; return((object)new[] { x }); }))); // When IReadOnlyList <TestDocument> documents = await ExecuteAsync(inputs, context, sidecar); // Then Assert.IsFalse(executedSidecarModules); Assert.AreEqual(inputs.First(), documents.First()); }
public async Task LoadsCustomSidecarFile() { // Given Engine engine = new Engine(); TestExecutionContext context = GetExecutionContext(engine); TestDocument[] inputs = { GetDocument("a/1.md", "File a1") }; string lodedSidecarContent = null; ProcessSidecarFile sidecar = new ProcessSidecarFile(".other", new ExecuteConfig(Config.FromDocument(async x => { lodedSidecarContent = await x.GetStringAsync(); return(new[] { x }); }))); // When IReadOnlyList <TestDocument> documents = await ExecuteAsync(inputs, context, sidecar); // Then Assert.AreEqual("data: other", lodedSidecarContent); Assert.AreEqual("File a1", documents.Single().Content); }