Beispiel #1
0
        public void DistributedId_ToString()
        {
            var id1 = new DistributedId(1);
            var id2 = new DistributedId(2);

            Assert.Equal("1", id1.ToString());
            Assert.Equal("2", id2.ToString());
        }
Beispiel #2
0
        public void DistributedId_Equals()
        {
            var id1 = new DistributedId(1);
            var id2 = new DistributedId(2);

            Assert.True(id1.Equals(id1));
            Assert.True(id2.Equals(id2));
            Assert.True(id1.Equals((object)id1));
            Assert.True(id2.Equals((object)id2));
            Assert.True(id1 == id1);
            Assert.True(id2 == id2);

            Assert.True(!id1.Equals(id2));
            Assert.True(!id2.Equals(id1));
            Assert.True(!id1.Equals((object)id2));
            Assert.True(!id2.Equals((object)id1));
            Assert.True(id1 != id2);
            Assert.True(id2 != id1);

            Assert.False(id1.Equals((object)1));
        }
Beispiel #3
0
        public void DistributedId_Comparison()
        {
            var id1 = new DistributedId(1);
            var id2 = new DistributedId(2);
            var id3 = new DistributedId(3);

            Assert.True(id1 < id2);
            Assert.True(id1 <= id2);
            Assert.True(id2 <= id2);
            Assert.True(id2 <= id3);
            Assert.True(id2 < id3);

            Assert.True(id1.CompareTo(id2) < 0);
            Assert.True(id2.CompareTo(id1) > 0);
            Assert.True(id2.CompareTo(id2) == 0);

            Assert.True(id3 > id2);
            Assert.True(id3 >= id2);
            Assert.True(id2 >= id1);
            Assert.True(id2 >= id1);
            Assert.True(id2 > id1);
        }
Beispiel #4
0
 public void DistributedId_TryParse_Invalid()
 {
     Assert.False(DistributedId.TryParse("not hex", out DistributedId distributedId));
     Assert.Equal(DistributedId.MinValue, distributedId);
 }
Beispiel #5
0
 public void DistributedId_TryParse_Valid()
 {
     Assert.True(DistributedId.TryParse("7B", out DistributedId distributedId));
     Assert.Equal(123ul, distributedId.Value);
 }
Beispiel #6
0
 public void DistributedId_Parse()
 {
     Assert.Equal(123ul, DistributedId.Parse("7B").Value);
 }