Exemplo n.º 1
0
        public void handle_should_return_false_if_protocol_not_compatible()
        {
            _socketMoq.Setup(_ => _.ProtocolType).Returns(() => ProtocolType.Raw);
            var handleResult = _sut.Handle(FirstPacket, FirstPacket.Length, _socketMoq.Object, null);

            VerifyHandleFailedDueToWrongSocketProtocolType(handleResult, _socketMoq);
        }
Exemplo n.º 2
0
        public void handle_should_only_close_timeout_handlers()
        {
            _tcpHanlderMoq = CreateTimeoutHandlerMock();
            _sut           = new TCPRelay(null, null, DefinitelyTimeoutSweepTime());
            var newCreatedTcpHandlerMock = new Mock <ITCPHandler>();

            newCreatedTcpHandlerMock.Setup(_ => _.Start(FirstPacket, FirstPacket.Length));
            newCreatedTcpHandlerMock.Setup(_ => _.LastActivity).Returns(DateTime.Now);
            _sut.TCPHandlerFactory = (controller, configuration, arg3, arg4) => newCreatedTcpHandlerMock.Object;
            _sut.Handlers.Add(_tcpHanlderMoq.Object);

            _sut.Handle(FirstPacket, FirstPacket.Length, _socketMoq.Object, null);

            VerifyProperlyHandleTimeoutHandlers(_tcpHanlderMoq, newCreatedTcpHandlerMock);
        }