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); }
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); }
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); }
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); }
public void AppIsInvalidWithNoControllers() { VolumeApp app = new VolumeApp(); Assert.IsFalse(app.IsValid); }