public async Task EmptyListWithDelimitorDoesNotError() { // Given JoinDocuments join = new JoinDocuments(","); // When ImmutableArray <TestDocument> results = await ExecuteAsync(join); // Then results.Single().Content.ShouldBeEmpty(); }
public async Task NullPassedInAsDocumentList() { // Given JoinDocuments join = new JoinDocuments(); // When ImmutableArray <TestDocument> results = await ExecuteAsync(join); // Then results.Single().Content.ShouldBeEmpty(); }
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"); }
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"); }
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); }
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"); }
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"); }