/// <summary>
        /// Compares two <see cref="IRowViewModelBase{Thing}"/>
        /// </summary>
        /// <param name="x">The first <see cref="IRowViewModelBase{Thing}"/> to compare</param>
        /// <param name="y">The second <see cref="IRowViewModelBase{Thing}"/> to compare</param>
        /// <returns>
        /// Less than zero : x is "lower" than y
        /// Zero: x "equals" y.
        /// Greater than zero: x is "greater" than y.
        /// </returns>
        public int Compare(IRowViewModelBase <Thing> x, IRowViewModelBase <Thing> y)
        {
            if (!(x.Thing is ElementDefinition) || !(y.Thing is ElementDefinition))
            {
                throw new InvalidOperationException("one or both of the parameters is not an Element Definition row.");
            }

            return(comparer.Compare((ElementDefinition)x.Thing, (ElementDefinition)y.Thing));
        }
Exemple #2
0
        public void TestComparer()
        {
            var usage1 = new ElementDefinition {
                Name = "type1"
            };
            var usage2 = new ElementDefinition {
                Name = "type5"
            };

            var comparer = new ElementDefinitionComparer();

            Assert.AreEqual(-4, comparer.Compare(usage1, usage2));
        }