Exemplo n.º 1
0
        private void TestChannelsAddedToCorrectLists(string fileName, SignalSource signalSource, int expectedTotal, int expectedTv, int expectedRadio, int dataProgramSid = 0, string dataProgramName = null)
        {
            var tempFile = TestUtils.DeploymentItem("Test.Loader.Sony\\TestFiles\\" + fileName);
            var plugin   = new SonyPlugin();
            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));

            // check that data channel is in the TV list
            if (dataProgramSid != 0)
            {
                var chan = list.Channels.FirstOrDefault(ch => ch.ServiceId == dataProgramSid);
                Assert.IsNotNull(chan);
                Assert.AreEqual(dataProgramName, chan.Name);
            }
        }
Exemplo n.º 2
0
        public void TestAndroidDeletingChannel()
        {
            var tempFile = TestUtils.DeploymentItem("Test.Loader.Sony\\TestFiles\\android_sdb-sat.xml");
            var plugin   = new SonyPlugin();
            var ser      = plugin.CreateSerializer(tempFile);

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

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

            // Pr# 128 = ORF2E

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

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

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

            Assert.IsTrue(orf2e.IsDeleted);
            Assert.IsTrue(orf2e.NewProgramNr > 0);
            Assert.AreEqual(0, 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 marked deleted
            dvbs  = data.GetChannelList(SignalSource.DvbS);
            orf2e = dvbs.Channels.FirstOrDefault(ch => ch.Name == "ORF2E");
            Assert.IsNotNull(orf2e);
            Assert.IsTrue(orf2e.IsDeleted);
            Assert.AreEqual(-1, orf2e.NewProgramNr);
        }