Beispiel #1
0
        public static string Encode(string prefix, long id)
        {
            var encoded = Hashids.EncodeLong(id);

            if (string.IsNullOrWhiteSpace(encoded))
            {
                throw new Exception("Encoded ID should not be empty");
            }

            return($"{prefix}_{encoded}");
        }
        public void ComputeHash()
        {
            string hash = hashService.EncodeLong(1);

            hash.Should().Be("6axJN");
        }
 public string Generate(long id)
 {
     return(hashGenerator.EncodeLong(id));
 }