예제 #1
0
        public void TestLongConstructor()
        {
            var peonyId = new PeonyId(72811205743345696);

            Assert.Equal(0, peonyId.Reserved);
            Assert.Equal(8679772108, peonyId.Timestamp);
            Assert.Equal(0, peonyId.Region);
            Assert.Equal(0, peonyId.Machine);
            Assert.Equal(32, peonyId.Sequence);
            Assert.Equal(PeonyId.PeonyIdTimer.PeonyIdEpoch.AddMilliseconds(8679772108), peonyId.CreationTime);
            Assert.Equal("72811205743345696", peonyId.ToString());
        }
예제 #2
0
        public void TestFullSizeCustomizedArgumentsConstructor()
        {
            var peonyId = new PeonyId(1, 8679772108, 5, 256, 1023);

            Assert.Equal(1, peonyId.Reserved);
            Assert.Equal(8679772108, peonyId.Timestamp);
            Assert.Equal(5, peonyId.Region);
            Assert.Equal(256, peonyId.Machine);
            Assert.Equal(1023, peonyId.Sequence);
            Assert.Equal(PeonyId.PeonyIdTimer.PeonyIdEpoch.AddMilliseconds(8679772108), peonyId.CreationTime);
            Assert.Equal("-9150560831105924097", peonyId.ToString());
        }