public void StartSession()
        {
            BamServer server;
            SecureServiceProxyClient <Echo> sspc;

            ServiceProxyTestHelpers.StartSecureChannelTestServerGetEchoClient(out server, out sspc);

            sspc.StartSession();
            server.Stop();
        }
        public void SecureServiceProxyInvokeShouldSucceed()
        {
            BamServer server;
            SecureServiceProxyClient <Echo> sspc;

            ServiceProxyTestHelpers.StartSecureChannelTestServerGetEchoClient(out server, out sspc);

            string value  = "InputValue_".RandomLetters(8);
            string result = sspc.Invoke <string>("Send", new object[] { value });

            server.Stop();
            Expect.AreEqual(value, result);
        }
        public void SecureServiceProxyInvokeShouldFireSessionStarting()
        {
            BamServer server;
            SecureServiceProxyClient <Echo> sspc;

            ServiceProxyTestHelpers.StartSecureChannelTestServerGetEchoClient(out server, out sspc);
            bool?sessionStartingCalled = false;

            sspc.SessionStarting += (c) =>
            {
                sessionStartingCalled = true;
            };

            sspc.Invoke <string>("Send", new object[] { "banana" });
            server.Stop();
            Expect.IsTrue(sessionStartingCalled.Value, "SessionStarting did not fire");
        }
        public void SecureServiceProxyInvokeShouldEstablishSessionIfSecureChannelServerRegistered()
        {
            BamServer server;
            SecureServiceProxyClient <Echo> sspc;

            ServiceProxyTestHelpers.StartSecureChannelTestServerGetEchoClient(out server, out sspc);

            Expect.IsFalse(sspc.SessionEstablished);
            string value  = "InputValue_".RandomLetters(8);
            string result = sspc.Invoke <string>("Send", new object[] { value });

            server.Stop();

            string msg = sspc.SessionStartException != null ? sspc.SessionStartException.Message : string.Empty;

            Expect.IsNull(sspc.SessionStartException, "SessionStartException: {0}"._Format(msg));
            Expect.IsTrue(sspc.SessionEstablished, "Session was not established");

            server.Stop();
        }