コード例 #1
0
        public void TestNoTuningDetailsChannel()
        {
            Dictionary <int, ITvCardHandler> cards = new Dictionary <int, ITvCardHandler>();
            List <IChannel> tuningDetails          = new List <IChannel>();

            IUser           user          = Fakes.FakeUser();
            TvBusinessLayer businessLayer = Fakes.FakeTvBusinessLayer();;
            TVController    controller    = Fakes.FakeTVController();

            DVBCardMocks   dvbCardMocks = GetCardMockByCardType(CardType.DvbC, tuningDetails, user);
            ITvCardHandler cardHandler1 = dvbCardMocks.GetMockedCardHandler();

            cards.Add(dvbCardMocks.CardId, cardHandler1);


            ChannelMap channelMap;
            Channel    channel = ChannelMocks.GetChannel(out channelMap);

            Isolate.WhenCalled(() => businessLayer.GetTuningChannelsByDbChannel(channel)).WillReturn(tuningDetails);
            TVControllerMocks.CardPresent(cardHandler1.DataBaseCard.IdCard, controller);

            SetupChannelMapping(cardHandler1, channelMap, businessLayer, channel);

            AdvancedCardAllocation allocation = new AdvancedCardAllocation(businessLayer, controller);

            TvResult          result;
            List <CardDetail> availCards = allocation.GetFreeCardsForChannel(cards, channel, ref user, out result);

            Assert.AreEqual(0, availCards.Count, "The number of cards returned is not as expected");
        }
コード例 #2
0
        private void TestWrongTuningDetailForCardForFTAChannel(CardType cardType)
        {
            Dictionary <int, ITvCardHandler> cards = new Dictionary <int, ITvCardHandler>();
            List <IChannel> tuningDetails          = new List <IChannel>();

            IUser           user          = Fakes.FakeUser();
            TvBusinessLayer businessLayer = Fakes.FakeTvBusinessLayer();;
            TVController    controller    = Fakes.FakeTVController();

            //we need to pick a different cardtype here-
            CardType cardTypeDifferent = cardType;

            switch (cardType)
            {
            case CardType.DvbT:
                cardTypeDifferent = CardType.DvbC;
                break;

            case CardType.DvbC:
                cardTypeDifferent = CardType.DvbS;
                break;

            case CardType.DvbS:
                cardTypeDifferent = CardType.DvbT;
                break;
            }
            IChannel tuningDetail1 = GetFTATuningDetailBasedOnCardType(cardTypeDifferent);

            tuningDetails.Add(tuningDetail1);

            DVBCardMocks   dvbCardMocks = GetCardMockByCardType(cardType, tuningDetails, user);
            ITvCardHandler cardHandler1 = dvbCardMocks.GetMockedCardHandler();

            //ITvCardHandler cardHandler1 = DVBTCardMocks.AddIdleFTADVBTCard(tuningDetail1, user);
            cards.Add(dvbCardMocks.CardId, cardHandler1);


            ChannelMap channelMap;
            Channel    channel = ChannelMocks.GetChannel(out channelMap);

            Isolate.WhenCalled(() => businessLayer.GetTuningChannelsByDbChannel(channel)).WillReturn(tuningDetails);
            TVControllerMocks.CardPresent(cardHandler1.DataBaseCard.IdCard, controller);

            SetupChannelMapping(cardHandler1, channelMap, businessLayer, channel);

            AdvancedCardAllocation allocation = new AdvancedCardAllocation(businessLayer, controller);

            TvResult          result;
            List <CardDetail> availCards = allocation.GetFreeCardsForChannel(cards, channel, ref user, out result);

            Assert.AreEqual(0, availCards.Count, "The number of cards returned is not as expected");
        }
コード例 #3
0
        private void TestOneAvailLockedCardForFTAChannel(CardType cardType)
        {
            Dictionary <int, ITvCardHandler> cards = new Dictionary <int, ITvCardHandler>();
            List <IChannel> tuningDetails          = new List <IChannel>();

            IUser           user          = Fakes.FakeUser();
            TvBusinessLayer businessLayer = Fakes.FakeTvBusinessLayer();;
            TVController    controller    = Fakes.FakeTVController();

            IChannel tuningDetail1 = GetFTATuningDetailBasedOnCardType(cardType);

            tuningDetails.Add(tuningDetail1);

            DVBCardMocks dvbCardMocks = GetCardMockByCardType(cardType, tuningDetails, user);

            dvbCardMocks.Idle = false;
            ITvCardHandler cardHandler1 = dvbCardMocks.GetMockedCardHandler();

            cards.Add(dvbCardMocks.CardId, cardHandler1);

            ChannelMap channelMap;
            Channel    channel = ChannelMocks.GetChannel(out channelMap);

            Isolate.WhenCalled(() => businessLayer.GetTuningChannelsByDbChannel(channel)).WillReturn(tuningDetails);
            TVControllerMocks.CardPresent(cardHandler1.DataBaseCard.IdCard, controller);

            SetupChannelMapping(cardHandler1, channelMap, businessLayer, channel);

            AdvancedCardAllocation allocation = new AdvancedCardAllocation(businessLayer, controller);

            TvResult          result;
            List <CardDetail> availCards = allocation.GetFreeCardsForChannel(cards, channel, ref user, out result);

            Assert.AreEqual(1, availCards.Count, "The number of cards returned is not as expected");
            Assert.AreEqual(availCards[0].SameTransponder, false, "same transponder not as expected");
        }