Exemplo n.º 1
0
        public static void ReadPrimitiveImmutableSortedSetT()
        {
            ImmutableSortedSet <int> result = JsonSerializer.Parse <ImmutableSortedSet <int> >(Encoding.UTF8.GetBytes(@"[1,2]"));
            int expected = 1;

            foreach (int i in result)
            {
                Assert.Equal(expected++, i);
            }

            result = JsonSerializer.Parse <ImmutableSortedSet <int> >(Encoding.UTF8.GetBytes(@"[]"));
            Assert.Equal(0, result.Count());
        }
        public void DeserializeSortedSet()
        {
            string json = @"[
  ""One"",
  ""II"",
  ""3""
]";

            ImmutableSortedSet <string> l = JsonConvert.DeserializeObject <ImmutableSortedSet <string> >(json);

            Assert.AreEqual(3, l.Count());
            Assert.IsTrue(l.Contains("3"));
            Assert.IsTrue(l.Contains("II"));
            Assert.IsTrue(l.Contains("One"));
        }
Exemplo n.º 3
0
        public async Task ReadPrimitiveImmutableSortedSetT()
        {
            ImmutableSortedSet <int> result = await JsonSerializerWrapperForString.DeserializeWrapper <ImmutableSortedSet <int> >(@"[1,2]");

            int expected = 1;

            foreach (int i in result)
            {
                Assert.Equal(expected++, i);
            }

            result = await JsonSerializerWrapperForString.DeserializeWrapper <ImmutableSortedSet <int> >(@"[]");

            Assert.Equal(0, result.Count());
        }