コード例 #1
0
        public static AssaultItemDetailModel ToDetailModel(this AssaultItem item)
        {
            var m = new AssaultItemDetailModel
            {
                Id = item.Id,
                Description = item.Description,
                Type = item.Type,
                LoadValue = item.LoadValue,
                Images = new List<string>()
            };

            var keywords = new Dictionary<string, string>
                               {
                                   {"Shock", "Shock_trooper_icon.png"},
                                   {"Scout", "Scout_trooper_icon.png"},
                                   {"Dark", "Dark_trooper_icon.png"},
                                   {"Storm", "Stormtrooper_icon.png"},
                                   {"AT-ST", "at_st.jpg"},
                                   {"Bike", "speeder_bike.jpg"},
                                   {"Blaster", "heavy_blaster.jpg"}
                               };

            if (item.Description != null)
            {
                foreach (var k in keywords)
                {
                    if (item.Description.ToLower().Contains(k.Key.ToLower()))
                    {
                        m.Images.Add(k.Value);
                    }
                }
            }

            return m;
        }
コード例 #2
0
 protected override void Before_each()
 {
     _model = new AssaultItemDetailModel
                  {
                      Description = "My Description",
                      LoadValue = 4,
                      Type = "My Type",
                      Images = new List<string> {"Dark_trooper_icon.png"}
                  };
 }
コード例 #3
0
 protected override void Because()
 {
     _model = _item.ToDetailModel();
 }