public void ClearShouldClearCacheContent()
        {
            // Arrange
            var sut = new PipelineCache <string>();

            sut.AddOrReplace("1", "1", "test");
            sut.AddOrReplace("1", "2", "test");
            sut.AddOrReplace("1", "3", "test");

            // Act
            sut.Clear();

            // Assert
            Assert.Empty(sut.ContentCopy());
        }
        public void AddShouldReplaceExistingItem()
        {
            // Arrange
            var sut = new PipelineCache <string>();
            var key = new CacheKey(1, 2);

            sut.AddOrReplace(key, "hello world");

            // Act
            sut.AddOrReplace(key, "test");

            // Assert
            var content = sut.ContentCopy().ToList();

            Assert.Collection(content, str => Assert.Equal("test", str));
        }
        public void ContentCopyShouldReturnCopyOfStoredElements()
        {
            // Arrange
            var sut = new PipelineCache <string>();

            sut.AddOrReplace("1", "1", "test1");
            sut.AddOrReplace("1", "2", "test2");
            sut.AddOrReplace("1", "3", "test3");

            // Act
            var actual = sut.ContentCopy();

            // Assert
            var expectedSubset = new HashSet <string> {
                "test1", "test2", "test3"
            };
            var actualSet = actual.ToHashSet();

            Assert.Subset(expectedSubset, actualSet);
        }
        public void RemoveValueShouldOnlyRemoveMatchingEntries()
        {
            // Arrange
            var sut = new PipelineCache <string>();

            sut.AddOrReplace("1", "1", "test1");
            sut.AddOrReplace("1", "2", "test2");
            sut.AddOrReplace("1", "3", "test3");

            // Act
            sut.RemoveValue("test2");

            // Assert
            var expectedSubset = new HashSet <string> {
                "test1", "test3"
            };
            var actualSet = sut.ContentCopy().ToHashSet();

            Assert.Subset(expectedSubset, actualSet);
        }