Ejemplo n.º 1
0
        void it_can_decode_from_a_hash_with_a_minimum_length()
        {
            var h = new Hashids(salt, 8);

            h.Decode("gB0NV05e").Should().Equal(new[] { 1 });
            h.Decode("mxi8XH87").Should().Equal(new[] { 25, 100, 950 });
            h.Decode("KQcmkIW8hX").Should().Equal(new[] { 5, 200, 195, 1 });
        }
Ejemplo n.º 2
0
        void it_does_not_decode_with_a_different_salt()
        {
            var peppers = new Hashids("this is my pepper");

            hashids.Decode("NkK9").Should().Equal(new[] { 12345 });
            peppers.Decode("NkK9").Should().Equal(new int[0]);
        }
Ejemplo n.º 3
0
 void issue_8_should_not_throw_out_of_range_exception()
 {
     var hashids = new Hashids("janottaa", 6);
     var numbers = hashids.Decode("NgAzADEANAA=");
 }
Ejemplo n.º 4
0
        void it_decodes_an_encoded_number()
        {
            hashids.Decode("NkK9").Should().Equal(new[] { 12345 });
            hashids.Decode("5O8yp5P").Should().Equal(new[] { 666555444 });

            hashids.Decode("Wzo").Should().Equal(new[] { 1337 });
            hashids.Decode("DbE").Should().Equal(new[] { 808 });
            hashids.Decode("yj8").Should().Equal(new[] { 303 });
        }