public void OnShouldRetryResponse_ReturnsFalse_IfOutsideThreshold()
        {
            ModbusIpTransport transport = new ModbusIpTransport(MockRepository.GenerateStub <IStreamResource>());
            IModbusMessage    request   = new ReadCoilsInputsRequest(Modbus.ReadCoils, 1, 1, 1);
            IModbusMessage    response  = new ReadCoilsInputsResponse(Modbus.ReadCoils, 1, 1, null);

            request.TransactionId  = 5;
            response.TransactionId = 2;
            transport.RetryOnOldResponseThreshold = 3;

            Assert.False(transport.OnShouldRetryResponse(request, response));
        }
Example #2
0
        public void OnShouldRetryResponse_ReturnsFalse_IfOutsideThreshold()
        {
            var transport = new ModbusIpTransport(StreamResourceMock, new ModbusFactory(), NullModbusLogger.Instance);
            var request   = new ReadCoilsInputsRequest(ModbusFunctionCodes.ReadCoils, 1, 1, 1);
            var response  = new ReadCoilsInputsResponse(ModbusFunctionCodes.ReadCoils, 1, 1, null);

            request.TransactionId  = 5;
            response.TransactionId = 2;
            transport.RetryOnOldResponseThreshold = 3;

            Assert.False(transport.OnShouldRetryResponse(request, response));
        }
Example #3
0
        public void OnShouldRetryResponse_ReturnsFalse_IfThresholdDisabled()
        {
            var transport = new ModbusIpTransport(StreamResourceMock.Object);
            var request   = new ReadCoilsInputsRequest(Modbus.ReadCoils, 1, 1, 1);
            var response  = new ReadCoilsInputsResponse(Modbus.ReadCoils, 1, 1, null);

            request.TransactionId  = 5;
            response.TransactionId = 4;
            transport.RetryOnOldResponseThreshold = 0;

            Assert.False(transport.OnShouldRetryResponse(request, response));
        }
        public void OnShouldRetryResponse_ReturnsFalse_IfOutsideThreshold()
        {
            var transport = new ModbusIpTransport(StreamResourceMock);
            var request   = new ReadCoilsInputsRequest(Modbus.ReadCoils, 1, 1, 1);
            var response  = new ReadCoilsInputsResponse(Modbus.ReadCoils, 1, 1, null);

            request.TransactionId  = 5;
            response.TransactionId = 2;
            transport.RetryOnOldResponseThreshold = 3;

            Assert.False((bool)transport.OnShouldRetryResponse(request, response));
        }
        public void OnShouldRetryResponse_ReturnsFalse_IfOutsideThreshold()
        {
            ModbusIpTransport transport = new ModbusIpTransport(MockRepository.GenerateStub<IStreamResource>());
            IModbusMessage request = new ReadCoilsInputsRequest(Modbus.ReadCoils, 1, 1, 1);
            IModbusMessage response = new ReadCoilsInputsResponse(Modbus.ReadCoils, 1, 1, null);

            request.TransactionId = 5;
            response.TransactionId = 2;
            transport.RetryOnOldResponseThreshold = 3;

            Assert.False(transport.OnShouldRetryResponse(request, response));
        }