Ejemplo n.º 1
0
        public void AppIsValidWithControllers()
        {
            Mock <IVolumeController> volumeController = new Mock <IVolumeController>();

            volumeController.Setup(s => s.IsValid).Returns(true);
            volumeController.Setup(s => s.Name).Returns("Volume Controller");
            AddComponentToConfigurationManager(volumeController.Object);
            VolumeApp app = new VolumeApp();

            app.Initialize(GetConfigurationManager());

            Assert.IsTrue(app.IsValid);
        }
Ejemplo n.º 2
0
        public void AdjustmentYesGrammar()
        {
            Dictionary <String, String> expectedVals = new Dictionary <string, string>
            {
                { "Command", "volume" },
                { "levelNum", "-1" },
            };
            Mock <IVolumeController> controller = new Mock <IVolumeController>(MockBehavior.Strict);

            controller.Setup(s => s.IsValid).Returns(true);
            controller.Setup(s => s.Name).Returns("Test Volume Controller");
            AddComponentToConfigurationManager(controller.Object);
            VolumeApp app = new VolumeApp();

            TestGrammar <VolumeApp>("yes", expectedVals, VolumeApp.VolumeGrammarName);
        }
Ejemplo n.º 3
0
        public void TurnTheVolumeUpOnSourceGrammar()
        {
            Dictionary <String, String> expectedVals = new Dictionary <string, string>
            {
                { "Command", "volume" },
                { "direction", "up" },
                { "levelNum", "-1" },
                { "source", "Test Source" },
            };
            Mock <IVolumeController> controller = new Mock <IVolumeController>(MockBehavior.Strict);

            controller.Setup(s => s.IsValid).Returns(true);
            controller.Setup(s => s.Name).Returns("Test Volume Controller");
            AddComponentToConfigurationManager(controller.Object);
            VolumeApp            app  = new VolumeApp();
            IOInterfaceReference ref1 = new IOInterfaceReference("", "Test Source", GetConfigurationManager());

            app.AddChild(ref1);
            TestGrammar(app, GetConfigurationManager(), "turn the volume up on the Test Source", expectedVals);
        }
Ejemplo n.º 4
0
        public void AppDoesNotAddReferences()
        {
            Mock <IVolumeController> volumeController = new Mock <IVolumeController>();

            volumeController.Setup(s => s.IsValid).Returns(true);
            volumeController.Setup(s => s.Name).Returns("Volume Controller");
            AddComponentToConfigurationManager(volumeController.Object);
            Mock <IVolumeController> volumeController2 = new Mock <IVolumeController>();

            volumeController2.Setup(s => s.IsValid).Returns(true);
            volumeController2.Setup(s => s.Name).Returns("Volume Controller Two");
            AddComponentToConfigurationManager(volumeController2.Object);
            VolumeApp app = new VolumeApp();

            app.AddChild(new IOInterfaceReference("", "Volume Controller", GetConfigurationManager()));

            app.Initialize(GetConfigurationManager());

            Assert.AreEqual(1, app.Children.OfType <IOInterfaceReference>().Count());
            Assert.AreEqual("Volume Controller", app.Children.OfType <IOInterfaceReference>().First().Name);
            Assert.AreEqual("", app.Children.OfType <IOInterfaceReference>().First().Tag);
        }
Ejemplo n.º 5
0
        public void AppIsInvalidWithNoControllers()
        {
            VolumeApp app = new VolumeApp();

            Assert.IsFalse(app.IsValid);
        }