Esempio n. 1
0
        public void TestDeletingChannel()
        {
            var tempFile = TestUtils.DeploymentItem("Test.Loader.Panasonic\\TestFiles\\svl-sat.db");
            var plugin   = new PanasonicPlugin();
            var ser      = plugin.CreateSerializer(tempFile);

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

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

            // Pr# 130 = ORF2E

            var dvbs  = data.GetChannelList(SignalSource.DvbS);
            var orf2e = dvbs.Channels.FirstOrDefault(ch => ch.Name == "ORF2E");

            Assert.IsNotNull(orf2e);
            Assert.AreEqual(130, orf2e.OldProgramNr);
            Assert.AreEqual(130, orf2e.NewProgramNr);
            Assert.IsFalse(orf2e.IsDeleted);

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

            Assert.IsTrue(orf2e.IsDeleted);
            Assert.IsTrue(orf2e.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);
            orf2e = dvbs.Channels.FirstOrDefault(ch => ch.Name == "ORF2E");
            Assert.IsNull(orf2e);
        }
Esempio n. 2
0
        private void TestChannelsAddedToCorrectLists(string fileName, SignalSource signalSource, int expectedTotal, int expectedTv, int expectedRadio)
        {
            var tempFile = TestUtils.DeploymentItem("Test.Loader.Panasonic\\TestFiles\\" + fileName);
            var plugin   = new PanasonicPlugin();
            var ser      = plugin.CreateSerializer(tempFile);

            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));

            // there are no data channels in Panasonic lists
        }