public void Join_Triple_Inside()
        {
            var request = new DataRequest("character");
            request.Parameters.Add("name.first_lower", "krusen");

            // Join character with outfit_member
            var join = new Join("outfit_member");
            join.InjectAt = "outfit";
            join.Show.Add("member_since_date", "rank", "rank_ordinal", "outfit_id");

            // Join outfit_member with outfit
            var join2 = new Join("outfit");
            join2.InjectAt = "outfit_info";
            join2.Show.Add("name", "alias", "member_count", "leader_character_id");

            // Join outfit with character
            var join3 = new Join("character");
            join3.InjectAt = "leader_profile";
            join3.Show.Add("name", "battle_rank");
            join3.On = "leader_character_id";
            join3.To = "character_id";

            request.JoinWith(join.JoinWith(join2.JoinWith(join3)));

            var expected = "?name.first_lower=krusen&c:join=outfit_member^inject_at:outfit^show:member_since_date'rank'rank_ordinal'outfit_id(outfit^inject_at:outfit_info^show:name'alias'member_count'leader_character_id(character^on:leader_character_id^to:character_id^inject_at:leader_profile^show:name'battle_rank))";
            var actual = request.QueryString;
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        // Expected result:
        // http://census.soe.com/s:soe/json/get/ps2:v2/character/?name.first_lower=krusen&c:join=outfit_member^inject_at:outfit^show:member_since_date'rank'rank_ordinal'outfit_id(outfit^show:name'alias'member_count'leader_character_id^inject_at:outfit_info(character^on:leader_character_id^to:character_id^inject_at:leader_profile^show:name'battle_rank))
        public static dynamic JoinTest()
        {
            // TODO: Test with 2 joins on same collection instead of just nested joins
            var api = new CensusApi("ps2:v2");
            var request = new DataRequest("character");
            request.Parameters.Add("name.first_lower", "krusen");

            // Join character with outfit_member
            var join = new Join("outfit_member");
            join.InjectAt = "outfit";
            join.Show.Add("member_since_date", "rank", "rank_ordinal", "outfit_id");

            // Join outfit_member with outfit
            var join2 = new Join("outfit");
            join2.InjectAt = "outfit_info";
            join2.Show.Add("name", "alias", "member_count", "leader_character_id");

            // Join outfit with character
            var join3 = new Join("character");
            join3.InjectAt = "leader_profile";
            join3.Show.Add("name", "battle_rank");
            join3.On = "leader_character_id";
            join3.To = "character_id";

            request.JoinWith(join.JoinWith(join2.JoinWith(join3)));

            return api.Execute(request);
        }
        public void Join_Single()
        {
            var request = new DataRequest("character");
            request.Parameters.Add("name.first_lower", "krusen");

            // Join character with outfit_member
            var join = new Join("outfit_member");
            join.InjectAt = "outfit";
            join.Show.Add("member_since_date", "rank", "rank_ordinal", "outfit_id");

            request.JoinWith(join);

            var expected = "?name.first_lower=krusen&c:join=outfit_member^inject_at:outfit^show:member_since_date'rank'rank_ordinal'outfit_id";
            var actual = request.QueryString;
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 4
0
        private DataRequest GetCharacterRequest()
        {
            var request = new DataRequest("character");

            var faction = new Join("faction");
            faction.InjectAt = "faction";

            var outfit = new Join("outfit_member_extended");
            outfit.InjectAt = "outfit_info";

            var outfitLeader = new Join("character");
            outfitLeader.Show.Add("name.first", "character_id");
            outfitLeader.On = "leader_character_id";
            outfitLeader.To = "character_id";
            outfitLeader.InjectAt = "leader";

            var online = new Join("characters_online_status");
            online.InjectAt = "online_status";

            var world = new Join("characters_world");
            world.InjectAt = "world";

            var worldInfo = new Join("world");
            worldInfo.InjectAt = "info";

            var currency = new Join("characters_currency");
            currency.InjectAt = "currency";

            // request.JoinWith("collection").On("char_id").To("char_id").InjectAt("collection_name").JoinWith(....
            request.JoinWith(world.JoinWith(worldInfo));
            request.JoinWith(outfit.JoinWith(outfitLeader));
            request.JoinWith(online);
            request.JoinWith(currency);
            request.JoinWith(faction);

            return request;
        }
Ejemplo n.º 5
0
 // TODO: Rename to AddJoin()?
 /// <summary>
 /// Method for adding a Join with improved readability and chaining posibilities.
 /// </summary>
 /// <param name="join"></param>
 /// <returns>Itself for easy chaining of joins</returns>
 public DataRequest JoinWith(Join join)
 {
     Joins.Add(join);
     return this;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Method for adding a Join with improved readability and chaining posibility.
 /// </summary>
 /// <param name="join"></param>
 /// <returns>Itself for easy chaining of joins</returns>
 public Join JoinWith(Join join)
 {
     Joins.Add(join);
     return this;
 }