Example #1
0
            public void MetadataReturnsCorrectDocuments()
            {
                // Given
                List <object> values = new List <object>();
                Engine        engine = new Engine();

                Core.Modules.Control.Documents documents = new Core.Modules.Control.Documents(
                    new Dictionary <string, object> {
                    { "Foo", "a" }
                },
                    new Dictionary <string, object> {
                    { "Foo", "b" }
                },
                    new Dictionary <string, object> {
                    { "Foo", "c" }
                });
                Execute gatherData = new Execute((d, c) =>
                {
                    values.Add(d["Foo"]);
                    return(null);
                }, false);

                engine.Pipelines.Add(documents, gatherData);

                // When
                engine.Execute();

                // Then
                Assert.AreEqual(3, values.Count);
                CollectionAssert.AreEqual(new[] { "a", "b", "c" }, values);
            }
Example #2
0
            public void ContentAndMetadataReturnsCorrectDocuments()
            {
                // Given
                List <string> content = new List <string>();
                List <object> values  = new List <object>();
                Engine        engine  = new Engine();

                Core.Modules.Control.Documents documents = new Core.Modules.Control.Documents(
                    Tuple.Create("A", new Dictionary <string, object> {
                    { "Foo", "a" }
                }.AsEnumerable()),
                    Tuple.Create("B", new Dictionary <string, object> {
                    { "Foo", "b" }
                }.AsEnumerable()),
                    Tuple.Create("C", new Dictionary <string, object> {
                    { "Foo", "c" }
                }.AsEnumerable()));
                Execute gatherData = new Execute((d, c) =>
                {
                    content.Add(d.Content);
                    values.Add(d["Foo"]);
                    return(null);
                }, false);

                engine.Pipelines.Add(documents, gatherData);

                // When
                engine.Execute();

                // Then
                Assert.AreEqual(3, content.Count);
                Assert.AreEqual(3, values.Count);
                CollectionAssert.AreEqual(new[] { "A", "B", "C" }, content);
                CollectionAssert.AreEqual(new[] { "a", "b", "c" }, values);
            }
Example #3
0
        public void MetadataReturnsCorrectDocuments()
        {
            // Given
            List<object> values = new List<object>();
            Engine engine = new Engine();
            engine.CleanOutputFolderOnExecute = false;
            engine.Trace.AddListener(new TestTraceListener());
            Core.Modules.Control.Documents documents = new Core.Modules.Control.Documents(
                new Dictionary<string, object> { { "Foo", "a" } },
                new Dictionary<string, object> { { "Foo", "b" } },
                new Dictionary<string, object> { { "Foo", "c" } });
            Execute gatherData = new Execute((d, c) =>
            {
                values.Add(d["Foo"]);
                return null;
            });
            engine.Pipelines.Add(documents, gatherData);

            // When
            engine.Execute();

            // Then
            Assert.AreEqual(3, values.Count);
            CollectionAssert.AreEqual(new[] { "a", "b", "c" }, values);
        }
Example #4
0
            public void ContentAndMetadataReturnsCorrectDocuments()
            {
                // Given
                List<string> content = new List<string>();
                List<object> values = new List<object>();
                Engine engine = new Engine();
                engine.CleanOutputPathOnExecute = false;
                Core.Modules.Control.Documents documents = new Core.Modules.Control.Documents(
                    Tuple.Create("A", new Dictionary<string, object> {{"Foo", "a"}}.AsEnumerable()),
                    Tuple.Create("B", new Dictionary<string, object> {{"Foo", "b"}}.AsEnumerable()),
                    Tuple.Create("C", new Dictionary<string, object> {{"Foo", "c"}}.AsEnumerable()));
                Execute gatherData = new Execute((d, c) =>
                {
                    content.Add(d.Content);
                    values.Add(d["Foo"]);
                    return null;
                });
                engine.Pipelines.Add(documents, gatherData);

                // When
                engine.Execute();

                // Then
                Assert.AreEqual(3, content.Count);
                Assert.AreEqual(3, values.Count);
                CollectionAssert.AreEqual(new[] {"A", "B", "C"}, content);
                CollectionAssert.AreEqual(new[] {"a", "b", "c"}, values);
            }
Example #5
0
            public void CountReturnsCorrectDocuments()
            {
                // Given
                Engine engine = new Engine();
                Core.Modules.Control.Documents documents = new Core.Modules.Control.Documents(5);
                engine.Pipelines.Add(documents);

                // When
                engine.Execute();

                // Then
                Assert.AreEqual(5, engine.Documents.Count());
            }
Example #6
0
            public void CountReturnsCorrectDocuments()
            {
                // Given
                Engine engine = new Engine();

                Core.Modules.Control.Documents documents = new Core.Modules.Control.Documents(5);
                engine.Pipelines.Add(documents);

                // When
                engine.Execute();

                // Then
                Assert.AreEqual(5, engine.Documents.Count());
            }
Example #7
0
        public void CountReturnsCorrectDocuments()
        {
            // Given
            Engine engine = new Engine();
            engine.CleanOutputFolderOnExecute = false;
            engine.Trace.AddListener(new TestTraceListener());
            Core.Modules.Control.Documents documents = new Core.Modules.Control.Documents(5);
            engine.Pipelines.Add(documents);

            // When
            engine.Execute();

            // Then
            Assert.AreEqual(5, engine.Documents.Count());
        }
Example #8
0
            public void ContentReturnsCorrectDocuments()
            {
                // Given
                List<string> content = new List<string>();
                Engine engine = new Engine();
                Core.Modules.Control.Documents documents = new Core.Modules.Control.Documents("A", "B", "C", "D");
                Execute gatherData = new Execute((d, c) =>
                {
                    content.Add(d.Content);
                    return null;
                });
                engine.Pipelines.Add(documents, gatherData);

                // When
                engine.Execute();

                // Then
                Assert.AreEqual(4, content.Count);
                CollectionAssert.AreEqual(new[] {"A", "B", "C", "D"}, content);
            }
Example #9
0
            public void ContentReturnsCorrectDocuments()
            {
                // Given
                List <string> content = new List <string>();
                Engine        engine  = new Engine();

                Core.Modules.Control.Documents documents = new Core.Modules.Control.Documents("A", "B", "C", "D");
                Execute gatherData = new Execute((d, c) =>
                {
                    content.Add(d.Content);
                    return(null);
                }, false);

                engine.Pipelines.Add(documents, gatherData);

                // When
                engine.Execute();

                // Then
                Assert.AreEqual(4, content.Count);
                CollectionAssert.AreEqual(new[] { "A", "B", "C", "D" }, content);
            }