예제 #1
0
        public void TestFriendsList()
        {
            string xml =
                @"<roar tick=""130868353269"">
              <friends>
                <list status=""ok"">
                  <friend>
                    <row_id/>
                    <player_id>19000494933</player_id>
                    <name>player_username</name>
                    <level>5</level>
                  </friend>
                  <friend>
                    <row_id/>
                    <player_id>90210</player_id>
                    <name>leroy</name>
                    <level>80</level>
                  </friend>
                </list>
              </friends>
            </roar>";

            IXMLNode nn = (new XMLNode.XMLParser()).Parse(xml);

            Roar.WebObjects.Friends.ListResponse response = new Roar.DataConversion.Responses.Friends.List().Build(nn);

            Assert.IsNotNull(response);
            Assert.AreEqual(response.friends.Count, 2);
            Assert.AreEqual(response.friends[0].name, "player_username");
            Assert.AreEqual(response.friends[1].name, "leroy");
            Assert.AreEqual(response.friends[1].level, "80");
            Assert.AreEqual(response.friends[0].level, "5");
            Assert.AreEqual(response.friends[0].player_id, "19000494933");
            Assert.AreEqual(response.friends[1].player_id, "90210");

            //confirm the exact xml response.
        }
예제 #2
0
        public void TestFriendsList()
        {
            string xml =
            @"<roar tick=""130868353269"">
              <friends>
                <list status=""ok"">
                  <friend>
                    <row_id/>
                    <player_id>19000494933</player_id>
                    <name>player_username</name>
                    <level>5</level>
                  </friend>
                  <friend>
                    <row_id/>
                    <player_id>90210</player_id>
                    <name>leroy</name>
                    <level>80</level>
                  </friend>
                </list>
              </friends>
            </roar>";

            IXMLNode nn = (new XMLNode.XMLParser()).Parse(xml);

            Roar.WebObjects.Friends.ListResponse response = new Roar.DataConversion.Responses.Friends.List().Build(nn);

            Assert.IsNotNull(response);
            Assert.AreEqual(response.friends.Count, 2);
            Assert.AreEqual(response.friends[0].name, "player_username");
            Assert.AreEqual(response.friends[1].name, "leroy");
            Assert.AreEqual(response.friends[1].level, "80");
            Assert.AreEqual(response.friends[0].level, "5");
            Assert.AreEqual(response.friends[0].player_id, "19000494933");
            Assert.AreEqual(response.friends[1].player_id, "90210");

            //confirm the exact xml response.
        }