public void TestGetKeysGreaterThan()
        {
            object objA = new object();
            object objB = new object();
            object objC = new object();

            var dictionary = new SortedNameValueDictionary <object>();

            dictionary.Add("A", objA);
            dictionary.Add("B", objB);
            dictionary.Add("C", objC);

            dictionary.Count.Should().Be(3);

            dictionary.GetKeysGreaterThan(null).Count().Should().Be(3);
            dictionary.GetKeysGreaterThan(string.Empty).Count().Should().Be(3);

            dictionary.GetKeysGreaterThan("A").Count().Should().Be(2);
            dictionary.GetKeysGreaterThan("B").Count().Should().Be(1);
            dictionary.GetKeysGreaterThan("C").Count().Should().Be(0);
        }
Exemple #2
0
        /// <summary>
        /// Gets the children in sorted order.
        /// </summary>
        /// <param name="startingChildName">Starting child name to get the children</param>
        /// <returns>List of names of children of this node in sorted order</returns>
        protected override IEnumerable <string> GetSortedChildren(string startingChildName)
        {
            AtomicDictionaryFacade <string, IPersistedData> atomicDictionaryFacade = this.childrenMapping as AtomicDictionaryFacade <string, IPersistedData>;
            SortedNameValueDictionary <IPersistedData>      sortedDictionary       = atomicDictionaryFacade?.UnderlyingDictionary as SortedNameValueDictionary <IPersistedData>;

            if (sortedDictionary == null)
            {
                return(GetSortedChildrenWithCondition(this.childrenMapping.Keys, startingChildName));
            }

            return(sortedDictionary.GetKeysGreaterThan(startingChildName));
        }