public void ReturnsNullWhenKeyNotFound() { // Given MetadataDictionary initialMetadata = new MetadataDictionary(); MetadataStack metadata = new MetadataStack(initialMetadata); // When IReadOnlyList <IDocument> result = metadata.DocumentList("A"); // Then Assert.IsNull(result); }
public void ReturnsEmptyListForSingleInt() { // Given MetadataDictionary initialMetadata = new MetadataDictionary { ["A"] = 1 }; MetadataStack metadata = new MetadataStack(initialMetadata); // When IReadOnlyList <IDocument> result = metadata.DocumentList("A"); // Then Assert.IsNotNull(result); CollectionAssert.IsEmpty(result); }
public void ReturnsListForSingleDocument() { // Given IDocument a = new TestDocument(); MetadataDictionary initialMetadata = new MetadataDictionary { ["A"] = a }; MetadataStack metadata = new MetadataStack(initialMetadata); // When IReadOnlyList <IDocument> result = metadata.DocumentList("A"); // Then Assert.IsNotNull(result); CollectionAssert.AreEqual(new[] { a }, result); }
public void ReturnsListForList() { // Given IDocument a = Substitute.For <IDocument>(); IDocument b = Substitute.For <IDocument>(); IDocument c = Substitute.For <IDocument>(); MetadataDictionary initialMetadata = new MetadataDictionary { ["A"] = new List <IDocument> { a, b, c } }; MetadataStack metadata = new MetadataStack(initialMetadata); // When IReadOnlyList <IDocument> result = metadata.DocumentList("A"); // Then Assert.IsNotNull(result); CollectionAssert.AreEqual(new [] { a, b, c }, result); }
public IReadOnlyList <IDocument> DocumentList(string key) => _metadata.DocumentList(key);