public void verifyThatOptionDependentValuesetsComparerCompareReturnsExpectedResults()
        {
            var comparer = new OptionComparer();

            Assert.AreEqual(0, comparer.Compare(null, null));

            Assert.AreEqual(1, comparer.Compare(null, this.optiona));

            Assert.AreEqual(-1, comparer.Compare(this.optiona, null));

            var comparisonab = comparer.Compare(this.optiona, this.optionb);

            Assert.AreEqual(1, comparisonab);

            var comparisonba = comparer.Compare(this.optionb, this.optiona);

            Assert.AreEqual(-1, comparisonba);

            var comparisonaa = comparer.Compare(this.optiona, this.optiona);

            Assert.AreEqual(0, comparisonaa);

            var comparisonbb = comparer.Compare(this.optionb, this.optionb);

            Assert.AreEqual(0, comparisonbb);
        }
        public void VerifyThatOptionsContainedInDifferentIterationsThrowsException()
        {
            var comparer = new OptionComparer();

            var iterationx = new Iteration(Guid.NewGuid(), null, null);
            var optionx    = new Option(Guid.NewGuid(), null, null);

            iterationx.Option.Add(optionx);

            var iterationy = new Iteration(Guid.NewGuid(), null, null);
            var optiony    = new Option(Guid.NewGuid(), null, null);

            iterationy.Option.Add(optiony);

            Assert.Throws <InvalidOperationException>(() => comparer.Compare(optionx, optiony));
        }
Ejemplo n.º 3
0
 public int CompareTo(string owner, string name)
 {
     return(OptionComparer.Compare(this, owner, name));
 }
Ejemplo n.º 4
0
 public int CompareTo(Option other)
 {
     return(OptionComparer.Compare(this, other));
 }