public void TestRestart()
        {
            CompilerOptions compilerOptions = new CompilerOptions();

            compilerOptions.Provider = new CSharpCodeProvider(new Dictionary <String, String>()
            {
                { "CompilerVersion", "v4.0" }
            });
            compilerOptions.Parameters.GenerateExecutable = false;
            compilerOptions.Parameters.GenerateInMemory   = true;
            compilerOptions.ScriptEntryType = "MossbauerLab.TinyTcpServer.Core.FunctionalTests.TestScripts.CustomScript";
            // CustomScript, LocalIpAddress, ServerPort, compilerOptions
            _server = new FlexibleTcpServer(CustomScript, LocalIpAddress, ServerPort, compilerOptions);
            Boolean result = _server.Start();

            Assert.IsTrue(result, "Checking that result is true");
            _server.Stop(true);
            result = _server.Start();
            Assert.IsTrue(result, "Checking that result is true");
            _server.Stop(true);
        }
Ejemplo n.º 2
0
        public void TestScriptRun(Int32 dataSize, Int32 repetition, Boolean isClientAsync)
        {
            _server = new FlexibleTcpServer(Script, LocalIpAddress, ServerPort);
            Boolean result = _server.Start();

            Assert.IsTrue(result, "Checking that result is true");
            using (TransportClient client = new TransportClient(isClientAsync, LocalIpAddress, ServerPort))
            {
                client.Open();
                ExchangeWithRandomDataAndCheck(client, dataSize, repetition);
                client.Close();
            }
            Assert.DoesNotThrow(() => _server.Stop(true), "Checking that server correctly stops");
        }
        private void TestScriptRunImpl(Int32 dataSize, Int32 repetition, Boolean isClientAsync,
                                       String script, String ipAddress, UInt16 port, CompilerOptions options)
        {
            _server = new FlexibleTcpServer(script, ipAddress, port, options);
            Boolean result = _server.Start();

            Assert.IsTrue(result, "Checking that result is true");
            using (TransportClient client = new TransportClient(isClientAsync, ipAddress, port))
            {
                client.Open();
                ExchangeWithRandomDataAndCheck(client, dataSize, repetition);
                client.Close();
            }
            Assert.DoesNotThrow(() => _server.Stop(true), "Checking that server correctly stops");
        }