Test.CBORExtraTest.TestArbitraryTypes C# (CSharp) Méthode

TestArbitraryTypes() private méthode

private TestArbitraryTypes ( ) : void
Résultat void
        public void TestArbitraryTypes()
        {
            CBORObject obj = CBORObject.FromObject(new { AByte.A, B = AInt.A, C =
                    AULong.A });
              Assert.AreEqual(254, obj["a"].AsInt32());
              Assert.AreEqual(256, obj["b"].AsInt32());
              Assert.AreEqual(999999, obj["c"].AsInt32());
              obj = CBORObject.FromObject(new { A = "a", B = "b" });
              {
            string stringTemp = obj["a"].AsString();
            Assert.AreEqual(
              "a",
              stringTemp);
              }
              {
            string stringTemp = obj["b"].AsString();
            Assert.AreEqual(
              "b",
              stringTemp);
              }
              CBORTestCommon.AssertRoundTrip(obj);
              obj = CBORObject.FromObject(new { A = "c", B = "b" });
              {
            string stringTemp = obj["a"].AsString();
            Assert.AreEqual(
              "c",
              stringTemp);
              }
              {
            string stringTemp = obj["b"].AsString();
            Assert.AreEqual(
              "b",
              stringTemp);
              }
              CBORTestCommon.AssertRoundTrip(obj);
              obj = CBORObject.FromObject(RangeExclusive(0, 10));
              Assert.AreEqual(10, obj.Count);
              Assert.AreEqual(0, obj[0].AsInt32());
              Assert.AreEqual(1, obj[1].AsInt32());
              obj = CBORObject.FromObject((object)RangeExclusive(0, 10));
              Assert.AreEqual(10, obj.Count);
              Assert.AreEqual(0, obj[0].AsInt32());
              Assert.AreEqual(1, obj[1].AsInt32());
              CBORTestCommon.AssertRoundTrip(obj);
              // Select all even numbers
              var query =
            from i in RangeExclusive(0, 10)
            where i % 2 == 0
            select i;
              obj = CBORObject.FromObject(query);
              Assert.AreEqual(5, obj.Count);
              Assert.AreEqual(0, obj[0].AsInt32());
              Assert.AreEqual(2, obj[1].AsInt32());
              CBORTestCommon.AssertRoundTrip(obj);
              // Select all even numbers
              var query2 =
            from i in RangeExclusive(0, 10)
            where i % 2 == 0
            select new { A = i, B = i + 1 };
              obj = CBORObject.FromObject(query2);
              Assert.AreEqual(5, obj.Count);
              Assert.AreEqual(0, obj[0]["a"].AsInt32());
              Assert.AreEqual(3, obj[1]["b"].AsInt32());
              CBORTestCommon.AssertRoundTrip(obj);
        }