Esempio n. 1
0
        private void TestChannelsAddedToCorrectLists(string filePath, SignalSource signalSource, int expectedTotal, int expectedTv, int expectedRadio)
        {
            var plugin = new PhilipsPlugin();
            var ser    = plugin.CreateSerializer(filePath);

            ser.Load();

            var root = ser.DataRoot;

            var list = root.GetChannelList(signalSource);

            Assert.IsNotNull(list);
            Assert.AreEqual(expectedTotal, list.Channels.Count);
            Assert.AreEqual(expectedTv, list.Channels.Count(ch => (ch.SignalSource & SignalSource.Tv) != 0));
            Assert.AreEqual(expectedRadio, list.Channels.Count(ch => (ch.SignalSource & SignalSource.Radio) != 0));

            // no data channels found in any of the Philips channel lists available to me
        }
Esempio n. 2
0
        public void TestDeletingChannel()
        {
            var tempFile = TestUtils.DeploymentItem("Test.Loader.Philips\\TestFiles") + "\\ChannelMap_100\\ChannelList\\chanLst.bin";
            var plugin   = new PhilipsPlugin();
            var ser      = plugin.CreateSerializer(tempFile);

            ser.Load();
            var data = ser.DataRoot;

            data.ValidateAfterLoad();
            data.ApplyCurrentProgramNumbers();

            // Pr# 42 = NTV HD

            var dvbs  = data.GetChannelList(SignalSource.DvbS);
            var ntvHd = dvbs.Channels.FirstOrDefault(ch => ch.Name == "NTV HD");

            Assert.IsNotNull(ntvHd);
            Assert.AreEqual(42, ntvHd.OldProgramNr);
            Assert.AreEqual(42, ntvHd.NewProgramNr);
            Assert.IsFalse(ntvHd.IsDeleted);

            ntvHd.NewProgramNr = -1;
            data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.Delete);

            Assert.IsTrue(ntvHd.IsDeleted);
            Assert.IsTrue(ntvHd.NewProgramNr == 0);
            Assert.AreEqual(1, dvbs.Channels.Count(ch => ch.NewProgramNr <= 0));


            // save and reload
            ser.Save(tempFile);
            ser = plugin.CreateSerializer(tempFile);
            ser.Load();
            data = ser.DataRoot;
            data.ValidateAfterLoad();
            data.ApplyCurrentProgramNumbers();

            // channel was deleted from database
            dvbs  = data.GetChannelList(SignalSource.DvbS);
            ntvHd = dvbs.Channels.FirstOrDefault(ch => ch.Name == "NTV HD");
            Assert.IsNull(ntvHd);
        }