コード例 #1
0
 void it_encodes_a_single_number()
 {
     hashids.Encode(1).Should().Be("NV");
     hashids.Encode(22).Should().Be("K4");
     hashids.Encode(333).Should().Be("OqM");
     hashids.Encode(9999).Should().Be("kQVg");
     hashids.Encode(123000).Should().Be("58LzD");
     hashids.Encode(456000000).Should().Be("5gn6mQP");
     hashids.Encode(987654321).Should().Be("oyjYvry");
 }
コード例 #2
0
        void it_can_encode_with_a_custom_alphabet()
        {
            var h = new Hashids(salt, 0, "ABCDEFGhijklmn34567890-:");

            h.Encode(1, 2, 3, 4, 5).Should().Be("6nhmFDikA0");
        }