コード例 #1
0
        public void Should_Convert_Guid_Correctly()
        {
            var id      = Guid.NewGuid();
            var shortId = ShortGuid.ToShortId(id);
            var longId  = ShortGuid.FromShortId(shortId);

            Assert.Equal(id, longId);
        }
コード例 #2
0
        public void FromShortId_Should_Convert_Correctly()
        {
            var shortId = Guid.NewGuid().ToShortId() + "==";

            Assert.NotNull(ShortGuid.FromShortId(shortId));

            shortId = ShortGuid.ToShortId(Guid.NewGuid()) + "==";
            Assert.NotNull(ShortGuid.FromShortId(shortId));
        }
コード例 #3
0
        public void MakeCorrectConvertation()
        {
            var guid    = new Guid();
            var newGuid = new Guid();

            try
            {
                newGuid = (Guid)ShortGuid.FromShortId(ShortGuid.ToShortId(guid));
            }
            catch (Exception e)
            {
                Assert.True(false, e.Message);
            }
            Assert.Equal(guid, newGuid);
        }