Esempio n. 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);
        }
Esempio n. 2
0
        public void GetDistinctStations_Test()
        {
            //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();
            ObservableCollection <Stations> stations = new ObservableCollection <Stations>();

            //Act
            station.GetDistinctStations(mockSystemInterface);

            //Assert
        }
Esempio n. 3
0
        public void ExtractNumAlarms_Test()
        {
            var Mock_SystemInfo = new Mock_SystemInfo();

            NodeType dbtype = new NodeType(Symbol.Intern("DatabaseManager"), false, false, new List <PropertyDefinition>());

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

            var Mock_NodeController = new Mock_INodeController();
            var mockSystemInterface = new Mock_SystemInterface(Mock_SystemInfo, Mock_NodeController);
            var station             = new Stations();

            var alarmList    = new List <AlarmRecord>();
            var alarmTime1   = DateTime.Now;
            var alarmRecord1 = new AlarmRecord(new NodeID(0, 1), Symbol.Intern("TestAlarm1"), alarmTime1, true);

            alarmList.Add(alarmRecord1);

            station.ExtractNumAlarms(QueryResult.Valid, alarmList, 1, mockSystemInterface);
        }