예제 #1
0
        public void SameString_ParsedAsSameGuid(string str)
        {
            var guids = Enumerable.Range(0, 10)
                        .Select(_ => (Guid)MiniGuid.Parse(str))
                        .ToHashSet();

            Assert.Single(guids);
        }
예제 #2
0
        public void Deserializes_FromString()
        {
            var json = @"{ ""guid"": ""abcdeABCDEabcdeABCDEabcdeA"" }";

            var dummy = JsonConvert.DeserializeObject <Dummy>(json);

            Assert.Equal(MiniGuid.Parse("abcdeABCDEabcdeABCDEabcdeA"), dummy.Guid);
        }
예제 #3
0
        public void ToString_Parse_RoundTrip()
        {
            for (int i = 0; i < 1000; i++)
            {
                var guid1 = MiniGuid.NewGuid();
                var guid2 = MiniGuid.Parse(guid1.ToString());

                Assert.Equal(guid1, guid2);
            }
        }