Beispiel #1
0
        public void CompareTo_should_return_the_correct_value(string oidA, string oidB, int result)
        {
            var        subject1 = new ElectionId(ObjectId.Parse(oidA));
            ElectionId subject2 = oidB == null ? (ElectionId)null : new ElectionId(ObjectId.Parse(oidB));

            subject1.CompareTo(subject2).Should().Be(result);
        }
Beispiel #2
0
            public bool IsStale(int setVersion, ElectionId electionId)
            {
                if (_setVersion < setVersion)
                {
                    return(true);
                }
                if (_setVersion > setVersion)
                {
                    return(false);
                }

                if (_electionId == null)
                {
                    return(true);
                }

                return(_electionId.CompareTo(electionId) <= 0);
            }
Beispiel #3
0
 public bool IsFresher(int setVersion, ElectionId electionId)
 {
     return
         (_setVersion > setVersion ||
          _setVersion == setVersion && _electionId != null && _electionId.CompareTo(electionId) > 0);
 }