Esempio n. 1
0
        public async Task EmptyListWithDelimitorDoesNotError()
        {
            // Given
            JoinDocuments join = new JoinDocuments(",");

            // When
            ImmutableArray <TestDocument> results = await ExecuteAsync(join);

            // Then
            results.Single().Content.ShouldBeEmpty();
        }
Esempio n. 2
0
        public async Task NullPassedInAsDocumentList()
        {
            // Given
            JoinDocuments join = new JoinDocuments();

            // When
            ImmutableArray <TestDocument> results = await ExecuteAsync(join);

            // Then
            results.Single().Content.ShouldBeEmpty();
        }
Esempio n. 3
0
        public async Task TwoDocumentsJoinWithDelimiterInText()
        {
            // Given
            TestDocument  first  = new TestDocument("Test");
            TestDocument  second = new TestDocument("Test2");
            JoinDocuments join   = new JoinDocuments("Test");

            // When
            ImmutableArray <TestDocument> results = await ExecuteAsync(new[] { first, second }, join);

            // Then
            results.Single().Content.ShouldBe("TestTestTest2");
        }
Esempio n. 4
0
        public async Task ThreeDocumentsWithNoDelimiterWhenFirstIsNull()
        {
            // Given
            TestDocument  first  = null;
            TestDocument  second = new TestDocument("Test2");
            TestDocument  third  = new TestDocument("Test3");
            JoinDocuments join   = new JoinDocuments();

            // When
            ImmutableArray <TestDocument> results = await ExecuteAsync(new[] { first, second, third }, join);

            // Then
            results.Single().Content.ShouldBe("Test2Test3");
        }
Esempio n. 5
0
        public async Task ResultHasNoMediaTypeWhenDifferent()
        {
            // Given
            TestDocument  first  = new TestDocument("Test", "Foo");
            TestDocument  second = new TestDocument();
            TestDocument  third  = new TestDocument("Test3", "Bar");
            JoinDocuments join   = new JoinDocuments(",");

            // When
            ImmutableArray <TestDocument> results = await ExecuteAsync(new[] { first, second, third }, join);

            // Then
            results.Single().Content.ShouldBe("Test,Test3");
            results.Single().ContentProvider.MediaType.ShouldBe(null);
        }
Esempio n. 6
0
        public async Task TwoDocumentsWithKeepLastMetaDataReturnKeepsLastMetaData()
        {
            // Given
            TestDocument first = new TestDocument("Test")
            {
                { "one", "two" }
            };
            TestDocument second = new TestDocument("Test2")
            {
                { "three", "four" }
            };
            JoinDocuments join = new JoinDocuments(JoinedMetadata.LastDocument);

            // When
            ImmutableArray <TestDocument> results = await ExecuteAsync(new[] { first, second }, join);

            // Then
            TestDocument result = results.Single();

            result.Keys.ShouldNotContain("one");
            result.Keys.ShouldContain("three");
        }
Esempio n. 7
0
        public async Task TwoDocumentsWithAllKeepFirstMetaData()
        {
            // Given
            TestDocument first = new TestDocument("Test")
            {
                { "one", "two" }
            };
            TestDocument second = new TestDocument("Test2")
            {
                { "one", "seven" },
                { "three", "four" }
            };
            JoinDocuments join = new JoinDocuments(JoinedMetadata.AllWithFirstDuplicates);

            // When
            ImmutableArray <TestDocument> results = await ExecuteAsync(new[] { first, second }, join);

            // Then
            TestDocument result = results.Single();

            result.Values.ShouldContain("two");
            result.Values.ShouldNotContain("seven");
            result.Keys.ShouldContain("three");
        }