public void EncodeWithPadding_AlphabetIsAnEmptyString_ThrowsArgumentNullException() { var exception = Assert.Throws <ArgumentException>(() => Bijective.Encode(1, "", 10)); Assert.Contains("alphabet must not be an empty string", exception.Message); }
public void EncodeWithPadding_PaddingLessThanZero_ThrowsArgumentOutOfRangeException() { var exception = Assert.Throws <ArgumentOutOfRangeException>(() => Bijective.Encode(1, Alphabet.Base62, -1)); Assert.Contains("padding must be greater than or equal to zero", exception.Message); }
public void EncodeWithPadding_AlphabetIsNull_ThrowsArgumentNullException() { var exception = Assert.Throws <ArgumentNullException>(() => Bijective.Encode(1, null, 10)); Assert.Contains("alphabet must not be null", exception.Message); }
public void Encode_ValueLessThanZero_ThrowsArgumentOutOfRangeException() { var exception = Assert.Throws <ArgumentOutOfRangeException>(() => Bijective.Encode(-1, Alphabet.Base62)); Assert.Contains("value must be greater than or equal to zero", exception.Message); }
public void EncodeWithPadding(string expected, int value, string alphabet, int padding) { Assert.Equal(expected, Bijective.Encode(value, alphabet, padding)); }
public void Encode(string result, int value, string alphabet) { Assert.Equal(result, Bijective.Encode(value, alphabet)); }
public string GetShortUri(int databaseId) { var shortUri = Bijective.Encode(databaseId); return(shortUri); }