Пример #1
0
 public static TvDatabase.Channel GetChannel(out ChannelMap channelMap)
 {
   channelMap = Isolate.Fake.Instance<ChannelMap>();
   List<ChannelMap> channelMaps = new List<ChannelMap>();
   channelMaps.Add(channelMap);
   TvDatabase.Channel channel = Isolate.Fake.Instance<TvDatabase.Channel>();
   Isolate.WhenCalled(() => channel.DisplayName).WillReturn("Test Channel");
   Isolate.WhenCalled(() => channel.ReferringChannelMap()).WillReturn(channelMaps);
   return channel;
 }
Пример #2
0
 public ChannelMap MapChannelToCard(Card card, Channel channel, bool epgOnly)
 {
   IList<ChannelMap> channelMaps = card.ReferringChannelMap();
   for (int i = 0; i < channelMaps.Count; ++i)
   {
     ChannelMap map = channelMaps[i];
     if (map.IdChannel == channel.IdChannel && map.IdCard == card.IdCard)
     {
       return map;
     }
   }
   ChannelMap newMap = new ChannelMap(channel.IdChannel, card.IdCard, epgOnly);
   newMap.Persist();
   return newMap;
 }
        public bool comparecardmappings(Channel channel1, Channel channel2)
        {
            #if(MP100)
            IList allmaps1 = channel1.ReferringChannelMap();
            #elif(MP101)
            IList<ChannelMap> allmaps1 = channel1.ReferringChannelMap();
            #else //MP11BETA or SVN
            IList<ChannelMap> allmaps1 = channel1.ReferringChannelMap();
            #endif

            ChannelMap[] channelmap1 = new ChannelMap[allmaps1.Count];
            int i = 0;
            foreach (ChannelMap map1 in allmaps1)
            {
                channelmap1[i++] = map1;
            }

            #if(MP100)
            IList allmaps2 = channel2.ReferringChannelMap();
            #elif(MP101)
            IList<ChannelMap> allmaps2 = channel2.ReferringChannelMap();
            #else //MP11BETA or SVN
            IList<ChannelMap> allmaps2 = channel2.ReferringChannelMap();
            #endif

            ChannelMap[] channelmap2 = new ChannelMap[allmaps2.Count];
            i = 0;
            foreach (ChannelMap map2 in allmaps2)
            {
                channelmap2[i++] = map2;
            }

            if (allmaps1.Count != allmaps2.Count)  //cardmap count not equal
                return false;

            for (i = 0; i < allmaps1.Count; i++)
            {
                if (channelmap1[i].IdCard != channelmap2[i].IdCard) //different cards
                    return false;
            }

            //    textoutput("Cardmappings equal for channel " + channel1.IdChannel + " and channel " + channel2.IdChannel);

            return true;
        }
Пример #4
0
    //TODO: move these helpers to other static classes

    private void SetupChannelMapping(ITvCardHandler cardHandler1, ChannelMap channelMap, TvBusinessLayer businessLayer, Channel channel)
    {
      Isolate.WhenCalled(() => channelMap.EpgOnly).WillReturn(false);
      Isolate.WhenCalled(() => channelMap.ReferencedCard().DevicePath).WillReturn(cardHandler1.DataBaseCard.DevicePath);

      TvDatabase.Card card = cardHandler1.DataBaseCard;
      Isolate.WhenCalled(() => businessLayer.IsChannelMappedToCard(channel, card, false)).WillReturn(true);      

    }