Esempio n. 1
0
        public void ConvertShortGuidTest()
        {
            var g = Guid.NewGuid();

            var shortGuid = g.ToShortGuid();

            Assert.Equal(g, ShortGuid.Parse(shortGuid));

            var shortGuidUrlFriendly = g.ToShortGuid(true);

            Assert.Equal(g, ShortGuid.Parse(shortGuidUrlFriendly, true));
        }
Esempio n. 2
0
 public Deck ToDeck()
 {
     return(new Deck
     {
         Id = ParseOrCreateGuid(id),
         GameId = ShortGuid.Parse(gameid),
         Name = name,
         Items = items.Select(i => new DeckItem
         {
             CardId = ShortGuid.Parse(i.id),
             Amount = i.amount
         }).ToArray()
     });
 }
Esempio n. 3
0
 private Guid ParseOrCreateGuid(string id)
 {
     return(String.IsNullOrEmpty(id) ? Guid.NewGuid() : ShortGuid.Parse(id));
 }
Esempio n. 4
0
        private static Guid GetGuid(string input)
        {
            Guid output;

            return(Guid.TryParse(input, out output) ? output : ShortGuid.Parse(input));
        }
        public static byte[] CreateCorrealtionIdBytes(string value)
        {
            var g = ShortGuid.Parse(value);

            return(Encoding.ASCII.GetBytes(g));
        }
Esempio n. 6
0
        public void ShortGuid_ShouldParseShortToNormal(string shortGuid, string guid)
        {
            var sut = ShortGuid.Parse(shortGuid);

            Assert.Equal(Guid.Parse(guid), sut.ToGuid());
        }