Пример #1
0
        public void FromShortId_Should_Convert_String_Correctly()
        {
            var guid         = Guid.NewGuid().ToString();
            var expectedGuid = guid.FromShortId();

            Assert.Equal(expectedGuid, ShortGuid.FromShortId(guid));
        }
Пример #2
0
        public void Should_Convert_Guid_Correctly()
        {
            var id      = Guid.NewGuid();
            var shortId = ShortGuid.ToShortId(id);
            var longId  = ShortGuid.FromShortId(shortId);

            Assert.Equal(id, longId);
        }
Пример #3
0
        public void FromShortId_Should_Convert_Correctly()
        {
            var shortId = Guid.NewGuid().ToShortId() + "==";

            Assert.NotNull(ShortGuid.FromShortId(shortId));

            shortId = ShortGuid.ToShortId(Guid.NewGuid()) + "==";
            Assert.NotNull(ShortGuid.FromShortId(shortId));
        }
Пример #4
0
 public void CorrectlyConvertStringGuidToGuid()
 {
     try
     {
         Assert.True(ShortGuid.FromShortId(Guid.NewGuid().ToShortId()) is Guid);
     }
     catch (Exception e)
     {
         Assert.True(false, e.Message);
     }
 }
Пример #5
0
 public void WorkCorrectlyIfFromShortIdTakesDoubleEquasion()
 {
     try
     {
         ShortGuid.FromShortId(Guid.NewGuid().ToShortId() + "==");
     }
     catch (Exception e)
     {
         Assert.True(false, e.Message);
     }
     Assert.True(true);
 }
Пример #6
0
        public void MakeCorrectConvertation()
        {
            var guid    = new Guid();
            var newGuid = new Guid();

            try
            {
                newGuid = (Guid)ShortGuid.FromShortId(ShortGuid.ToShortId(guid));
            }
            catch (Exception e)
            {
                Assert.True(false, e.Message);
            }
            Assert.Equal(guid, newGuid);
        }
Пример #7
0
 public void ReturnNullIfFromFhortIdArgumentIsNull()
 {
     Assert.Null(ShortGuid.FromShortId(null));
 }
Пример #8
0
 public void ThrowExceptionIfFromFhortIdArgumentIsNotValid()
 {
     Assert.Throws <FormatException>(() => ShortGuid.FromShortId("Definitely not Guid"));
 }
Пример #9
0
        public void IfPassNullThenReturnNull()
        {
            var newGuid = ShortGuid.FromShortId(null);

            Assert.Null(newGuid);
        }
Пример #10
0
 public void FromShortId_Returns_Null_If_Argument_Null()
 {
     Assert.Null(ShortGuid.FromShortId(null));
 }
Пример #11
0
 public void FromShortId_Should_Fail_If_Argument_Invalid()
 {
     Assert.Throws <FormatException>(() => ShortGuid.FromShortId("1234"));
 }