예제 #1
0
            public void ReturnsTrueWithBase64GuidResultFromUrlUnsafeInputWithPadding(Guid expected, String input)
            {
                input = input.Replace("-", "+").Replace("_", "/") + "==";

                var result = Base64Guid.TryParse(input, options => {
                    options.UseStandardBase64Encoding();
                    options.UsePadding();
                }, out var output);

                Assert.Equal(expected, output.Guid);
            }
예제 #2
0
            public void ReturnsUrlUnsafeBase64StringWithPadding(Guid input, String expected)
            {
                expected = expected.Replace("-", "+").Replace("_", "/") + "==";

                var base64Guid = new Base64Guid(input, options => {
                    options.UseStandardBase64Encoding();
                    options.UsePadding();
                });

                var result = base64Guid.ToString();

                Assert.Equal(expected, result);
            }
예제 #3
0
            public void ReturnsBase64Guid(Guid expected, string input)
            {
                var result = Base64Guid.Parse(input);

                Assert.Equal(expected, result.Guid);
            }
예제 #4
0
 public void ThrowsWhenStringContentIsInvalidForUrlUnsafeInput(string input)
 {
     input = input.Replace("+", "-").Replace("/", "_");
     Assert.Throws <FormatException>(() => Base64Guid.Parse(input, options => options.UseStandardBase64Encoding()));
 }
예제 #5
0
 public void ThrowsWhenStringContentIsInvalid(string input)
 {
     Assert.Throws <FormatException>(() => Base64Guid.Parse(input));
 }
예제 #6
0
 public void ThrowsWhenStringLengthIsInvalidForInputWithPadding(string input)
 {
     input += "==";
     Assert.Throws <FormatException>(() => Base64Guid.Parse(input, options => options.UsePadding()));
 }
예제 #7
0
 public ActionResult <string> GetWithRouteParameter(Base64Guid id)
 {
     return(id.Guid.ToString());
 }
예제 #8
0
            public void ConstructsWithEmptyGuid()
            {
                var result = new Base64Guid();

                Assert.Equal(Guid.Empty, result.Guid);
            }
예제 #9
0
 public void ThrowsWhenArgumentIsNull() => Assert.Throws <ArgumentNullException>(() => Base64Guid.Parse(null));
예제 #10
0
 public ActionResult <String> GetWithQueryParameter(Base64Guid id) => id.Guid.ToString();
예제 #11
0
 public void ThrowsWhenStringLengthIsInvalid(String input) => Assert.Throws <FormatException>(() => Base64Guid.Parse(input));