Example #1
0
        public void IsValid()
        {
            RemoteApp            app  = new RemoteApp();
            IOInterfaceReference ref1 = new IOInterfaceReference();

            app.AddChild(ref1);

            Assert.IsTrue(app.IsValid);
            Assert.AreEqual(String.Empty, app.InvalidMessage);
        }
Example #2
0
        public void ReferencesAppearInProperty()
        {
            RemoteApp            app  = new RemoteApp();
            IOInterfaceReference ref1 = new IOInterfaceReference();

            app.AddChild(ref1);
            IOInterfaceReference ref2 = new IOInterfaceReference();

            app.AddChild(ref2);
            Mock <IParseable> notARef = new Mock <IParseable>(MockBehavior.Strict);

            notARef.Setup(s => s.IsValid).Returns(true);

            IEnumerable <IOInterfaceReference> references = app.References;

            Assert.AreEqual(2, references.Count());
            Assert.IsTrue(references.Contains(ref1));
            Assert.IsTrue(references.Contains(ref2));
        }
Example #3
0
        public void AddPowerRemoteReference()
        {
            RemoteApp            app  = new RemoteApp();
            PowerRemoteReference ref1 = new PowerRemoteReference();

            ref1.Properties.Single(r => r.Name.Equals("RemoteName")).Setter("Test Remote");
            app.AddChild(ref1);

            Assert.AreEqual(1, app.Children.Count());
            Assert.IsInstanceOfType(app.Children.First(), typeof(IOInterfaceReference));
            Assert.AreEqual("Power", (app.Children.First() as IOInterfaceReference).Tag);
            Assert.AreEqual("Test Remote", (app.Children.First() as IOInterfaceReference).Name);
        }
Example #4
0
        private void TestGrammar(String channel, String remoteButton, String dialog)
        {
            Dictionary <String, String> expectedParams = new Dictionary <string, string>
            {
                { "Command", "remote" },
                { "remoteButton", remoteButton },
                { "channel", channel },
            };
            Mock <ITVRemote> remote = new Mock <ITVRemote>(MockBehavior.Strict);

            remote.Setup(s => s.IsValid).Returns(true);
            remote.Setup(s => s.GetChannels()).Returns(new List <String> {
                "Test Channel"
            });
            AddComponentToConfigurationManager(remote.Object);
            RemoteApp app = new RemoteApp();

            app.AddChild(new IOInterfaceReference());

            TestGrammar(app, GetConfigurationManager(), dialog, expectedParams);

            remote.Verify(s => s.GetChannels(), Times.Exactly(1));
        }