예제 #1
0
        public void GetNumActiveAlarmsFromSmartSUB_CheckFunctionCallIncrements()
        {
            //Arrange
            var      Mock_SystemInfo     = new Mock_SystemInfo();
            var      Mock_NodeController = new Mock_INodeController();
            var      mockSystemInterface = new Mock_SystemInterface(Mock_SystemInfo, Mock_NodeController);
            var      station             = new Stations();
            NodeType nodeType            = new NodeType(Symbol.Intern("TestType1"), false, false, new List <PropertyDefinition>());

            Mock_SystemInfo.mock_addNodeDefinition(nodeType, "DatabaseManager", null, new NodeID(0, 1));

            //Act
            uint actualCallCount   = Mock_NodeController.sendNodeCommandCallCount;
            uint expectedCallCount = 0;

            //Assert
            Assert.AreEqual(expectedCallCount, actualCallCount);

            //Act
            station.GetNumActiveAlarmsFromSmartSUB(mockSystemInterface, 1);
            expectedCallCount = 1;
            actualCallCount   = Mock_NodeController.sendNodeCommandCallCount;
            string expectedMessage = Mock_NodeController.sendNodeCommandLastCommand.ToString();
            string actualMessage   =
                "GetRecords ( NodeID = NodeID ( NodeID : uint32 = 0x0001ffff ), UpdateKind : uint8 = 0x03, Record = ActiveAlarm ( ) )";

            //Assert
            Assert.AreEqual(expectedCallCount, actualCallCount);
            Assert.AreEqual(expectedMessage, actualMessage);
        }