Exemple #1
0
        public async void Connect_Should_Return_Error_On_Incorrect_Data(int readTimeout, int writeTimeout, int pingTimeout)
        {
            //Arrange
            var connector = new EthernetConnector(new TcpSocket("127.0.0.1", 10620));

            //Assert
            await Assert.ThrowsAnyAsync <ArgumentOutOfRangeException>(() => connector.Connect(readTimeout, writeTimeout, pingTimeout));
        }
Exemple #2
0
        public async void Connect_Should_Return_Connected_On_Valid_Data(int readTimeout, int writeTimeout, int pingTimeout)
        {
            //Arrange
            var connector = new EthernetConnector(new TcpSocket("127.0.0.1", 10619));

            using var mockServer = new MockServer(new TcpServer(10619));
            mockServer.Start();

            //Act
            var result = await connector.Connect(readTimeout, writeTimeout, pingTimeout);

            mockServer.Stop();
            //Assert
            Assert.Equal(ConnectionStatus.Connected, result);
        }