Example #1
0
        public void AsyncGetExtenderConfigTest(KsiService service)
        {
            if (TestSetup.PduVersion == PduVersion.v1)
            {
                return;
            }

            ManualResetEvent waitHandle     = new ManualResetEvent(false);
            ExtenderConfig   config         = null;
            object           testObject     = new object();
            bool             isAsyncCorrect = false;

            service.BeginGetExtenderConfig(delegate(IAsyncResult ar)
            {
                try
                {
                    isAsyncCorrect = ar.AsyncState == testObject;
                    config         = service.EndGetExtenderConfig(ar);
                }
                finally
                {
                    waitHandle.Set();
                }
            }, testObject);

            Assert.IsTrue(waitHandle.WaitOne(10000), "Wait handle timed out.");

            Assert.IsNotNull(config, "Extender configuration should not be null.");
            Assert.AreEqual(true, isAsyncCorrect, "Unexpected async state.");
        }
Example #2
0
        public void BeginetExtenderConfigWithoutExtendingServiceProtocol()
        {
            KsiService service = new KsiService(null, null, null, null, null, null);

            KsiServiceException ex = Assert.Throws <KsiServiceException>(delegate
            {
                service.BeginGetExtenderConfig(null, null);
            });

            Assert.That(ex.Message.StartsWith("Extending service protocol is missing from service"), "Unexpected exception message: " + ex.Message);
        }
Example #3
0
        public void BeginGetExtenderConfigWithoutExtendingServiceCredentials()
        {
            TestKsiServiceProtocol protocol = new TestKsiServiceProtocol();
            KsiService             service  = new KsiService(null, null, protocol, null, null, null);

            KsiServiceException ex = Assert.Throws <KsiServiceException>(delegate
            {
                service.BeginGetExtenderConfig(null, null);
            });

            Assert.That(ex.Message.StartsWith("Extending service credentials are missing."), "Unexpected exception message: " + ex.Message);
        }