Exemple #1
0
            public void ReturnsOriginalDocumentForMissingSidecarFile()
            {
                // Given
                Engine            engine  = new Engine();
                IExecutionContext context = GetExecutionContext(engine);

                IDocument[] inputs =
                {
                    GetDocument("a/1.md", "File a1")
                };
                bool    executedSidecarModules = false;
                Sidecar sidecar = new Sidecar(".foo", new Execute((x, ctx) =>
                {
                    executedSidecarModules = true;
                    return(new[] { x });
                }));

                // When
                IEnumerable <IDocument> documents = sidecar.Execute(inputs, context).ToArray();

                // Then
                Assert.IsFalse(executedSidecarModules);
                Assert.AreEqual(inputs.First(), documents.First());
            }
Exemple #2
0
            public void LoadsCustomSidecarFile()
            {
                // Given
                Engine            engine  = new Engine();
                IExecutionContext context = GetExecutionContext(engine);

                IDocument[] inputs =
                {
                    GetDocument("a/1.md", "File a1")
                };
                string  lodedSidecarContent = null;
                Sidecar sidecar             = new Sidecar(".other", new Execute((x, ctx) =>
                {
                    lodedSidecarContent = x.Content;
                    return(new[] { x });
                }));

                // When
                IEnumerable <IDocument> documents = sidecar.Execute(inputs, context).ToArray();

                // Then
                Assert.AreEqual("data: other", lodedSidecarContent);
                Assert.AreEqual("File a1", documents.Single().Content);
            }