public void ZWaveNodeTryStartPairingReturnsFalse() { Mock <IZWaveController> controller = new Mock <IZWaveController>(MockBehavior.Strict); controller.Setup(s => s.IsInitialized).Returns(true); ZWaveNode.SetController(controller.Object); Mock <IInternalConfigurationManager> configManager = new Mock <IInternalConfigurationManager>(); MockZWaveNode node = new MockZWaveNode(); controller.Setup(s => s.TryStartPairing(node, null)).Returns(false); Assert.IsFalse(node.TryStartPairing(null)); Assert.IsFalse(node.IsValid); controller.Verify(s => s.TryStartPairing(node, null), Times.Exactly(1)); }
public void ZWaveNodeTryStartPairingNoCallback() { Mock <IZWaveController> controller = new Mock <IZWaveController>(MockBehavior.Strict); controller.Setup(s => s.IsInitialized).Returns(true); ZWaveNode.SetController(controller.Object); Mock <IInternalConfigurationManager> configManager = new Mock <IInternalConfigurationManager>(); MockZWaveNode node = new MockZWaveNode(); controller.Setup(s => s.TryStartPairing(node, null)).Returns(true); Assert.IsTrue(node.TryStartPairing(null)); node.NodeId = 1; Assert.AreEqual(1, node.NodeId); controller.Verify(s => s.TryStartPairing(node, null), Times.Exactly(1)); }