Beispiel #1
0
        public void HostTest()
        {
            TcpSocketAdapter target = new TcpSocketAdapter();

            target.Host = string.Empty;
            Assert.AreEqual(string.Empty, target.Host);
            target.Host = "test";
            Assert.AreEqual("test", target.Host);
        }
Beispiel #2
0
        public void PortTest()
        {
            TcpSocketAdapter target = new TcpSocketAdapter();

            target.Port = 0;
            Assert.AreEqual(0, target.Port);
            target.Port = 10000;
            Assert.AreEqual(10000, target.Port);
        }
Beispiel #3
0
        public void ConnectionTimeoutTest()
        {
            TcpSocketAdapter target = new TcpSocketAdapter();
            int expected            = 0;
            int actual;

            target.ConnectionTimeout = expected;
            actual = target.ConnectionTimeout;
            Assert.AreEqual(expected, actual);
        }
Beispiel #4
0
        public void DataStreamTest()
        {
            TcpSocketAdapter target = new TcpSocketAdapter();

            try {
                var val = target.DataStream;
            }
            catch (InvalidOperationException)
            {
                return;
            }
            Assert.Fail("DataStream getter must throw InvalidOperationException exception when socket is not connected");
        }
Beispiel #5
0
        public void OpenTest()
        {
            TcpSocketAdapter target = new TcpSocketAdapter();

            try
            {
                target.Open();
                Assert.Fail("Must throw an ArgumentException");
            }
            catch (ArgumentException)
            {
            }

            target = new TcpSocketAdapter("test", 123);
            try
            {
                target.Open();
                Assert.Fail("Must throw an SocketException");
            }
            catch (SocketException)
            {
            }
        }
Beispiel #6
0
        public void CloseTest()
        {
            TcpSocketAdapter target = new TcpSocketAdapter();

            target.Close();
        }
Beispiel #7
0
        public void DisposeTest()
        {
            TcpSocketAdapter target = new TcpSocketAdapter();

            target.Dispose();
        }
Beispiel #8
0
        public void ConnectedTest()
        {
            TcpSocketAdapter target = new TcpSocketAdapter();

            Assert.IsFalse(target.Connected);
        }