예제 #1
0
        /// <summary>
        /// This is a test to validate the TestManagerServer implementation.
        /// </summary>
        /// <returns></returns>
        //public MFTestResults TestManager_Test(int scenarioToRun)
        //{
        //    //test to verify the server functionality and logic of this test harness.
        //    //Just sleep a couple of seconds to simulate activity.
        //    //Thread.Sleep(2000);
        //    Console.WriteLine("Executing Scenario:" + scenarioToRun);
        //    return MFTestResults.Pass;
        //}

#if CLIENT_TESTS
        /// <summary>
        /// This is a test to validate all combinations of connections to be made.
        /// </summary>
        /// <returns></returns>
        public MFTestResults VerifyServerConnectionCombinations(int scenarioToRun)
        {
            SslTestTable sslTestTable = new SslTestTable(ipAddress);

            if (sslTestTable.sslServer.Length <= scenarioToRun)
            {
                Console.WriteLine("Trying to execute a test that isn't in the SslTestTable.  Make sure to run a valid scenario.");
                return(MFTestResults.Fail);
            }

            SslServer sslServer = sslTestTable.sslServer[scenarioToRun];

            Console.WriteLine("Executing Scenario:" + scenarioToRun);
            MFTestResults testResult = MFTestResults.Pass;

            try
            {
                testResult = sslServer.RunServer();
            }
            catch (CryptographicException ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(
                    "An error has occurred while using or authenticating " +
                    "this connection.  Check to make sure you've exported " +
                    "your certificate and that it is correctly referenced " +
                    "in CreateFromCertFile above.");
                testResult = MFTestResults.Fail;
            }
            catch (AuthenticationException ex)
            {
                Console.WriteLine(ex.Message);
                testResult = MFTestResults.Fail;
            }
            catch (SocketException ex)
            {
                Console.WriteLine(ex.Message);
                testResult = MFTestResults.Fail;
            }
            catch (IOException ex)
            {
                Console.WriteLine(ex.Message);
                testResult = MFTestResults.Fail;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                testResult = MFTestResults.Fail;
            }

            return(testResult);
        }
예제 #2
0
        /// <summary>
        /// This is a test to validate the TestManagerServer implementation.
        /// </summary>
        /// <returns></returns>
        //public MFTestResults TestManager_Test(int scenarioToRun)
        //{
        //    //test to verify the server functionality and logic of this test harness.
        //    //Just sleep a couple of seconds to simulate activity.
        //    //Thread.Sleep(2000);
        //    Console.WriteLine("Executing Scenario:" + scenarioToRun);
        //    return MFTestResults.Pass;
        //}

#if CLIENT_TESTS
        /// <summary>
        /// This is a test to validate all combinations of connections to be made.
        /// </summary>
        /// <returns></returns>
        public MFTestResults VerifyServerConnectionCombinations(int scenarioToRun)
        {
            SslTestTable sslTestTable = new SslTestTable(ipAddress);

            if (sslTestTable.sslServer.Length <= scenarioToRun)
            {
                Console.WriteLine("Trying to execute a test that isn't in the SslTestTable.  Make sure to run a valid scenario.");
                return MFTestResults.Fail;
            }

            SslServer sslServer = sslTestTable.sslServer[scenarioToRun];
            Console.WriteLine("Executing Scenario:" + scenarioToRun);
            MFTestResults testResult = MFTestResults.Pass;

            try
            {
                testResult = sslServer.RunServer();
            }
            catch (CryptographicException ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(
                    "An error has occurred while using or authenticating " +
                    "this connection.  Check to make sure you've exported " +
                    "your certificate and that it is correctly referenced " +
                    "in CreateFromCertFile above.");
                testResult = MFTestResults.Fail;
            }
            catch (AuthenticationException ex)
            {
                Console.WriteLine(ex.Message);
                testResult = MFTestResults.Fail;
            }
            catch (SocketException ex)
            {
                Console.WriteLine(ex.Message);
                testResult = MFTestResults.Fail;
            }
            catch (IOException ex)
            {
                Console.WriteLine(ex.Message);
                testResult = MFTestResults.Fail;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                testResult = MFTestResults.Fail;
            }

            return testResult;
        }