Beispiel #1
0
        public void RemovesContainedEntriesWhenDeleted()
        {
            // Setup
            var entries = new AutorouteEntries();

            var initialEntries = new List <AutorouteEntry>()
            {
                new AutorouteEntry("container", "container-path"),
                new AutorouteEntry("container", "contained-path1", "contained1"),
                new AutorouteEntry("container", "contained-path2", "contained2")
            };

            entries.AddEntries(initialEntries);

            // Act
            var updatedEntries = new List <AutorouteEntry>()
            {
                new AutorouteEntry("container", "container-path"),
                new AutorouteEntry("container", "contained-path1", "contained1")
            };

            entries.AddEntries(updatedEntries);
            var result = entries.TryGetEntryByPath("/contained-path2", out var entry);

            // Test
            Assert.False(result);
        }
Beispiel #2
0
        public void RemovesOldPaths()
        {
            // Setup
            var entries = new AutorouteEntries();

            entries.AddEntry("container", "container-path");

            // Act
            entries.RemoveEntry("container", "container-path");
            var result = entries.TryGetEntryByPath("/container-path", out var entry);

            // Test
            Assert.False(result);
        }
Beispiel #3
0
        public void ShouldGetEntryByContainedContentItemId()
        {
            // Setup
            var entries = new AutorouteEntries();

            var initialEntries = new List <AutorouteEntry>()
            {
                new AutorouteEntry("container", "container-path"),
                new AutorouteEntry("container", "contained-path", "contained")
            };

            entries.AddEntries(initialEntries);

            // Act
            var result = entries.TryGetEntryByContentItemId("contained", out var containedEntry);

            // Test
            Assert.True(result);
            Assert.Equal("/contained-path", containedEntry.Path);
        }