Exemple #1
0
        public void DecodeIntegerZeroValid()
        {
            int actual   = BCoder.DecodeInteger("i0e");
            int expected = 0;

            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public void DecodeIntegerNegativeNumberValid()
        {
            int actual   = BCoder.DecodeInteger("i-9e");
            int expected = -9;

            Assert.AreEqual(expected, actual);
        }
Exemple #3
0
        public void DecodeIntegerValidNumber()
        {
            int actual   = BCoder.DecodeInteger("i95e");
            int expected = 95;

            Assert.AreEqual(expected, actual);
        }
Exemple #4
0
        public void DecodeListValid2()
        {
            List <object> expected = new List <object>();

            expected.Add("abc");
            expected.Add("123");
            List <object> actual = BCoder.DecodeList("l3:abc3:123e");

            CheckListsAreEqual(expected, actual);
        }
Exemple #5
0
        public void DecodeListValid1()
        {
            List <object> expected = new List <object>();

            expected.Add(4);
            expected.Add(5);
            List <object> actual = BCoder.DecodeList("li4ei5ee");

            CheckListsAreEqual(expected, actual);
        }
Exemple #6
0
 public void DecodeIntegerEmptyInputInvalid()
 {
     try
     {
         int actual = BCoder.DecodeInteger("");
         Assert.Fail();
     }
     catch (ArgumentException)
     {
     }
 }
Exemple #7
0
 public void DecodeIntegerJustMinusInvalid()
 {
     try
     {
         int actual = BCoder.DecodeInteger("i-e");
         Assert.Fail();
     }
     catch (ArgumentException)
     {
     }
 }
Exemple #8
0
 public void DecodeIntegerStartWithZeroInvalid()
 {
     try
     {
         int actual = BCoder.DecodeInteger("i09e");
         Assert.Fail();
     }
     catch (ArgumentException)
     {
     }
 }
Exemple #9
0
 public void DecodeIntegerNegativeZeroInvalid()
 {
     try
     {
         int actual = BCoder.DecodeInteger("i-0e");
         Assert.Fail();
     }
     catch (ArgumentException)
     {
     }
 }
Exemple #10
0
 public void DecodeIntegerFakeStringInvalid()
 {
     try
     {
         int actual = BCoder.DecodeInteger("i293920oejdjd203e");
         Assert.Fail();
     }
     catch (ArgumentException)
     {
     }
 }
Exemple #11
0
 public void DecodeIntegerGarbageStringInvalid()
 {
     try
     {
         int actual = BCoder.DecodeInteger("sj1s910j9101uj3901");
         Assert.Fail();
     }
     catch (ArgumentException)
     {
     }
 }