コード例 #1
0
        public void ContentAndMetadataReturnsCorrectDocuments()
        {
            // Given
            List<string> content = new List<string>();
            List<object> values = new List<object>();
            Engine engine = new Engine();
            engine.Trace.AddListener(new TestTraceListener());
            Core.Modules.Documents documents = new Core.Modules.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);
        }
コード例 #2
0
        public void MetadataReturnsCorrectDocuments()
        {
            // Given
            List <object> values = new List <object>();
            Engine        engine = new Engine();

            engine.Trace.AddListener(new TestTraceListener());
            Core.Modules.Documents documents = new Core.Modules.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);
        }
コード例 #3
0
        public void CountReturnsCorrectDocuments()
        {
            // Given
            Engine engine = new Engine();
            engine.Trace.AddListener(new TestTraceListener());
            Core.Modules.Documents documents = new Core.Modules.Documents(5);
            engine.Pipelines.Add(documents);

            // When
            engine.Execute();

            // Then
            Assert.AreEqual(5, engine.Documents.Count());
        }
コード例 #4
0
        public void CountReturnsCorrectDocuments()
        {
            // Given
            Engine engine = new Engine();

            engine.Trace.AddListener(new TestTraceListener());
            Core.Modules.Documents documents = new Core.Modules.Documents(5);
            engine.Pipelines.Add(documents);

            // When
            engine.Execute();

            // Then
            Assert.AreEqual(5, engine.Documents.Count());
        }
コード例 #5
0
        public void ContentReturnsCorrectDocuments()
        {
            // Given
            List<string> content = new List<string>();
            Engine engine = new Engine();
            engine.Trace.AddListener(new TestTraceListener());
            Core.Modules.Documents documents = new Core.Modules.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);
        }
コード例 #6
0
        public void ContentReturnsCorrectDocuments()
        {
            // Given
            List <string> content = new List <string>();
            Engine        engine  = new Engine();

            engine.Trace.AddListener(new TestTraceListener());
            Core.Modules.Documents documents = new Core.Modules.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);
        }
コード例 #7
0
        public void ContentAndMetadataReturnsCorrectDocuments()
        {
            // Given
            List <string> content = new List <string>();
            List <object> values  = new List <object>();
            Engine        engine  = new Engine();

            engine.Trace.AddListener(new TestTraceListener());
            Core.Modules.Documents documents = new Core.Modules.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);
        }
コード例 #8
0
        public void MetadataReturnsCorrectDocuments()
        {
            // Given
            List<object> values = new List<object>();
            Engine engine = new Engine();
            engine.Trace.AddListener(new TestTraceListener());
            Core.Modules.Documents documents = new Core.Modules.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);
        }