示例#1
0
        public void FromJsonTest_InvalidJson()
        {
            string    json     = "Invalid";
            BaseValue expected = null;
            BaseValue result   = BaseValue.FromJson(json);

            Assert.AreEqual(expected, result);
        }
示例#2
0
        public void FromJsonTest_Succes()
        {
            string    json     = "{\"StatKey\":\"B_DMG\",\"value\":10}";
            BaseValue expected = new BaseValue()
            {
                Key = "B_DMG", Value = 10
            };
            BaseValue result = BaseValue.FromJson(json);

            Assert.AreEqual(expected.Key, result.Key);
            Assert.AreEqual(expected.Value, result.Value);
        }
示例#3
0
        public void FromJsonTest_IncompleteJson_NoKey()
        {
            string    json     = "{\"value\":10}";
            BaseValue expected = new BaseValue()
            {
                Key = null, Value = 10
            };
            BaseValue result = BaseValue.FromJson(json);

            Assert.AreEqual(expected.Key, result.Key);
            Assert.AreEqual(expected.Value, result.Value);
        }
示例#4
0
        public void FromJsonTest_IncompleteJson_NoValue()
        {
            string    json     = "{\"StatKey\":\"B_DMG\"}";
            BaseValue expected = new BaseValue()
            {
                Key = "B_DMG", Value = 0
            };
            BaseValue result = BaseValue.FromJson(json);

            Assert.AreEqual(expected.Key, result.Key);
            Assert.AreEqual(expected.Value, result.Value);
        }