public void AsyncGetAggregatorConfigTest(KsiService service) { if (TestSetup.PduVersion == PduVersion.v1) { return; } ManualResetEvent waitHandle = new ManualResetEvent(false); AggregatorConfig config = null; object testObject = new object(); bool isAsyncCorrect = false; service.BeginGetAggregatorConfig(delegate(IAsyncResult ar) { try { isAsyncCorrect = ar.AsyncState == testObject; config = service.EndGetAggregatorConfig(ar); } finally { waitHandle.Set(); } }, testObject); Assert.IsTrue(waitHandle.WaitOne(10000), "Wait handle timed out."); Assert.IsNotNull(config, "Aggregator configuration should not be null."); Assert.AreEqual(true, isAsyncCorrect, "Unexpected async state."); }
public void BeginGetAggregatorConfigWithoutSigningServiceProtocol() { KsiService service = new KsiService(null, null, null, null, null, null); KsiServiceException ex = Assert.Throws <KsiServiceException>(delegate { service.BeginGetAggregatorConfig(null, null); }); Assert.That(ex.Message.StartsWith("Signing service protocol is missing from service"), "Unexpected exception message: " + ex.Message); }
public void BeginGetAggregatorConfigWithoutSigningServiceCredentials() { TestKsiServiceProtocol protocol = new TestKsiServiceProtocol(); KsiService service = new KsiService(protocol, null, null, null, null, null); KsiServiceException ex = Assert.Throws <KsiServiceException>(delegate { service.BeginGetAggregatorConfig(null, null); }); Assert.That(ex.Message.StartsWith("Signing service credentials are missing."), "Unexpected exception message: " + ex.Message); }