コード例 #1
0
ファイル: UidTests.cs プロジェクト: smarkets/IronSmarkets
 public void SlugTest()
 {
     var uid1 = new Uid(340, 2034);
     var uid2 = new Uid(3408723498, 20347893249);
     Assert.Equal(uid1.ToSlug(UidTag.Account), "a-1fn9i4uf0qcq7sjlq9");
     Assert.Equal(uid2.ToSlug(UidTag.Account), "a-8k9z998uxzp3343bc0ongh");
     UidTag tag;
     var uid3 = Uid.ParseSlug("1fn9i4uf0qcq7sjlq9", out tag);
     Assert.Equal(uid3, uid1);
     Assert.Equal(UidTag.Account, tag);
     var uid4 = Uid.ParseSlug("a-8k9z998uxzp3343bc0ongh", out tag);
     Assert.Equal(uid4, uid2);
     Assert.Equal(UidTag.Account, tag);
     Assert.Throws<ArgumentException>(() => Uid.ParseSlug("c-8k9z998uxzp3343bc0ongh", out tag));
     Assert.Throws<ArgumentException>(() => Uid.ParseSlug("a", out tag));
     Assert.Throws<ArgumentException>(() => Uid.ParseSlug("", out tag));
     Assert.Throws<ArgumentNullException>(() => Uid.ParseSlug(null, out tag));
 }