private static IVerificationContext GetVerificationContext(TestingRow testingRow, IKsiSignature signature, string testDataDir, bool setUserPublication = false)
        {
            IPublicationsFile publicationsFile = null;
            IKsiService       service;

            if (!setUserPublication)
            {
                publicationsFile = GetPublicationsFile(string.IsNullOrEmpty(testingRow.PublicationsFilePath) ? null : testDataDir + testingRow.PublicationsFilePath,
                                                       string.IsNullOrEmpty(testingRow.CertFilePath) ? null : testDataDir + testingRow.CertFilePath);
            }

            if (string.IsNullOrEmpty(testingRow.ResourceFile))
            {
                service = IntegrationTests.GetHttpKsiService();
            }
            else
            {
                TestKsiServiceProtocol protocol = new TestKsiServiceProtocol
                {
                    RequestResult = File.ReadAllBytes(Path.Combine(TestSetup.LocalPath, testDataDir + testingRow.ResourceFile))
                };
                service =
                    new TestKsiService(
                        protocol,
                        new ServiceCredentials(Properties.Settings.Default.HttpSigningServiceUser, Properties.Settings.Default.HttpSigningServicePass,
                                               TestUtil.GetHashAlgorithm(Properties.Settings.Default.HttpSigningServiceHmacAlgorithm)),
                        protocol,
                        new ServiceCredentials(Properties.Settings.Default.HttpExtendingServiceUser, Properties.Settings.Default.HttpExtendingServicePass,
                                               TestUtil.GetHashAlgorithm(Properties.Settings.Default.HttpExtendingServiceHmacAlgorithm)),
                        protocol,
                        new PublicationsFileFactory(
                            new PkiTrustStoreProvider(new X509Store(StoreName.Root),
                                                      CryptoTestFactory.CreateCertificateSubjectRdnSelector("[email protected]"))), 1, PduVersion.v2);
            }

            return(new VerificationContext(signature)
            {
                DocumentHash = testingRow.InputHash,
                UserPublication = setUserPublication ? testingRow.PublicationData : null,
                IsExtendingAllowed = testingRow.IsExtendingAllowed,
                KsiService = service,
                PublicationsFile = publicationsFile,
                DocumentHashLevel = testingRow.InputHashLevel
            });
        }
        public void VerifyWithExtendingAndKey()
        {
            TestKsiServiceProtocol protocol = new TestKsiServiceProtocol
            {
                PublicationsFileBytes = File.ReadAllBytes(Path.Combine(TestSetup.LocalPath, Resources.KsiPublicationsFile_201712))
            };

            TestKsiService staticKsiService = new TestKsiService(
                null,
                null,
                protocol,
                new ServiceCredentials(TestConstants.ServiceUser, TestConstants.ServicePass),
                protocol,
                new PublicationsFileFactory(new TestPkiTrustProvider()),
                1043101455,
                PduVersion.v2);

            VerificationResult result = Policy.Verify(TestUtil.GetSignature(Resources.KsiSignature_Ok_20171219), null, staticKsiService);

            CheckResult(result, VerificationResultCode.Ok, null, 2, typeof(KeyBasedVerificationPolicy));
        }
Пример #3
0
        public void HAGetConfigResultsWithExtendRequestTest()
        {
            // Test getting extender configurations via ExtenderConfigChanged event handler when using Extend method.
            // Testing getting different configurations in a sequence

            HAKsiService haService = GetHAService(
                new List <PduPayload>()
            {
                GetExtendResponsePayload(Resources.KsiService_ExtendResponsePdu_RequestId_1043101454),
                GetExtenderConfigResponsePayload(4, new List <string>()
                {
                    "uri-1"
                }, 1136073601, 1136073602)
            },
                new List <PduPayload>()
            {
                GetExtendResponsePayload(Resources.KsiService_ExtendResponsePdu_RequestId_1043101455),
                GetExtenderConfigResponsePayload(4, new List <string>()
                {
                    "uri-2"
                }, 1136073601, 1136073602)
            });

            TestKsiService secondService = (TestKsiService)haService.ExtendingServices[1];

            secondService.RequestId = 1043101455;

            ExtenderConfig   resultConf  = null;
            int              changeCount = 0;
            ManualResetEvent waitHandle  = new ManualResetEvent(false);

            haService.ExtenderConfigChanged += delegate(object sender, ExtenderConfigChangedEventArgs e)
            {
                resultConf = e.ExtenderConfig;
                changeCount++;
                if (changeCount == 2)
                {
                    waitHandle.Set();
                }
            };

            CalendarHashChain cal = haService.Extend(123);

            Assert.AreEqual(1455494400, cal.PublicationTime, "Unexpected calendar hash chain publication time.");
            waitHandle.WaitOne(1000);
            Assert.IsNotNull(resultConf, "Could not get extender config using event handler.");

            Assert.AreEqual(4, resultConf.MaxRequests, "Unexpected max requests value");
            Assert.AreEqual(1, resultConf.ParentsUris.Count, "Unexpected parent uri count");
            Assert.IsTrue(resultConf.ParentsUris[0] == "uri-1" || resultConf.ParentsUris[0] == "uri-2", "Unexpected parent uri value at position 0");
            Assert.AreEqual(1136073601, resultConf.CalendarFirstTime, "Unexpected calendar first time value");
            Assert.AreEqual(1136073602, resultConf.CalendarLastTime, "Unexpected calendar last time value");

            // changing extender algorithm or parent uri should not change merged config
            TestKsiService newService = (TestKsiService)GetService(new List <PduPayload>()
            {
                GetExtendResponsePayload(Resources.KsiService_ExtendResponsePdu_RequestId_1043101455),
                GetExtenderConfigResponsePayload(4, new List <string>()
                {
                    "uri-2-changed"
                }, 1136073601, 1136073602)
            });

            secondService.ExtendingServiceProtocol.RequestResult = newService.ExtendingServiceProtocol.RequestResult;

            resultConf  = null;
            changeCount = 0;
            haService.Extend(123);
            Thread.Sleep(1000);
            Assert.IsNull(resultConf, "Extender config should have not changed (2nd request)");
            Assert.AreEqual(0, changeCount, "Unexpected change count (2nd request)");

            // changing max requests should change merged config
            newService = (TestKsiService)GetService(new List <PduPayload>()
            {
                GetExtendResponsePayload(Resources.KsiService_ExtendResponsePdu_RequestId_1043101455),
                GetExtenderConfigResponsePayload(5, new List <string>()
                {
                    "uri-2"
                }, 1136073601, 1136073602)
            });

            secondService.ExtendingServiceProtocol.RequestResult = newService.ExtendingServiceProtocol.RequestResult;

            waitHandle.Reset();
            resultConf  = null;
            changeCount = 0;
            haService.Extend(123);
            waitHandle.WaitOne(1000);

            Assert.IsNotNull(resultConf, "Could not get extender config using event handler (after 3rd extend request).");

            Assert.AreEqual(5, resultConf.MaxRequests, "Unexpected max requests value (after 3rd extend request)");
            Assert.AreEqual(1, resultConf.ParentsUris.Count, "Unexpected parent uri count (after 3rd extend request)");
            Assert.IsTrue(resultConf.ParentsUris[0] == "uri-1" || resultConf.ParentsUris[0] == "uri-2", "Unexpected parent uri value at position 0 (after 3rd extend request)");
            Assert.AreEqual(1136073601, resultConf.CalendarFirstTime, "Unexpected calendar first time value (after 3rd extend request)");
            Assert.AreEqual(1136073602, resultConf.CalendarLastTime, "Unexpected calendar last time value (after 3rd extend request)");

            // changing first time should change merged config
            newService = (TestKsiService)GetService(new List <PduPayload>()
            {
                GetExtendResponsePayload(Resources.KsiService_ExtendResponsePdu_RequestId_1043101455),
                GetExtenderConfigResponsePayload(5, new List <string>()
                {
                    "uri-2"
                }, 1136073600, 1136073602)
            });

            secondService.ExtendingServiceProtocol.RequestResult = newService.ExtendingServiceProtocol.RequestResult;

            waitHandle.Reset();
            resultConf  = null;
            changeCount = 0;

            haService.Extend(123);
            waitHandle.WaitOne(1000);
            Assert.IsNotNull(resultConf, "Could not get extender config using event handler (after 4th extend request).");

            Assert.AreEqual(5, resultConf.MaxRequests, "Unexpected max requests value (after 4th extend request)");
            Assert.AreEqual(1, resultConf.ParentsUris.Count, "Unexpected parent uri count (after 4th extend request)");
            Assert.IsTrue(resultConf.ParentsUris[0] == "uri-1" || resultConf.ParentsUris[0] == "uri-2", "Unexpected parent uri value at position 0 (after 4th extend request)");
            Assert.AreEqual(1136073600, resultConf.CalendarFirstTime, "Unexpected calendar first time value (after 4th extend request)");
            Assert.AreEqual(1136073602, resultConf.CalendarLastTime, "Unexpected calendar last time value (after 4th extend request)");

            // changing last time should change merged config
            newService = (TestKsiService)GetService(new List <PduPayload>()
            {
                GetExtendResponsePayload(Resources.KsiService_ExtendResponsePdu_RequestId_1043101455),
                GetExtenderConfigResponsePayload(5, new List <string>()
                {
                    "uri-2"
                }, 1136073600, 1136073603)
            });

            secondService.ExtendingServiceProtocol.RequestResult = newService.ExtendingServiceProtocol.RequestResult;

            waitHandle.Reset();
            resultConf  = null;
            changeCount = 0;

            haService.Extend(123);
            waitHandle.WaitOne(1000);
            Assert.IsNotNull(resultConf, "Could not get extender config using event handler (after 5th extend request).");

            Assert.AreEqual(5, resultConf.MaxRequests, "Unexpected max requests value (after 5th extend request)");
            Assert.AreEqual(1, resultConf.ParentsUris.Count, "Unexpected parent uri count (after 5th extend request)");
            Assert.IsTrue(resultConf.ParentsUris[0] == "uri-1" || resultConf.ParentsUris[0] == "uri-2", "Unexpected parent uri value at position 0 (after 5th extend request)");
            Assert.AreEqual(1136073600, resultConf.CalendarFirstTime, "Unexpected calendar first time value (after 5th extend request)");
            Assert.AreEqual(1136073603, resultConf.CalendarLastTime, "Unexpected calendar last time value (after 5th extend request)");

            // extending again should not change merged config
            waitHandle.Reset();
            resultConf  = null;
            changeCount = 0;

            haService.Extend(123);
            waitHandle.WaitOne(1000);
            Assert.IsNull(resultConf, "Extender config should have not changed (after 6th extend request)");
            Assert.AreEqual(0, changeCount, "Unexpected change count.");
        }
Пример #4
0
        public void HAGetConfigResultsAndRemoveOneTest()
        {
            // A configuration request with 2 successful sub-requests is made.
            // Then a new configuration request is made with 1 successful and 1 unsuccessful sub-requests.
            // Unsuccessful service config should be removed from cache and merged config should be recalculated

            HAKsiService haService = GetHAService(
                new List <PduPayload>()
            {
                GetExtenderConfigResponsePayload(4, new List <string>()
                {
                    "uri-1"
                }, 1136073601, 2136073601)
            },
                new List <PduPayload>()
            {
                GetExtenderConfigResponsePayload(4, new List <string>()
                {
                    "uri-2"
                }, 1136073601, 2136073601)
            });

            ManualResetEvent waitHandle = new ManualResetEvent(false);

            haService.ExtenderConfigChanged += delegate
            {
            };

            ExtenderConfig resultConf = haService.GetExtenderConfig();

            waitHandle.WaitOne(1000);

            Assert.AreEqual(4, resultConf.MaxRequests, "Unexpected max requests value");
            Assert.AreEqual(1, resultConf.ParentsUris.Count, "Unexpected parent uri count");
            Assert.AreEqual(1136073601, resultConf.CalendarFirstTime, "Unexpected calendar first time value");
            Assert.AreEqual(2136073601, resultConf.CalendarLastTime, "Unexpected calendar last time value");

            // change first service response so that request fails
            ((TestKsiService)haService.ExtendingServices[0]).ExtendingServiceProtocol.RequestResult =
                File.ReadAllBytes(Path.Combine(TestSetup.LocalPath, Resources.KsiService_ExtendResponsePdu_RequestId_1043101455));

            // change second service response so that a valid configuration is returned
            TestKsiService newService = (TestKsiService)GetService(new List <PduPayload>()
            {
                GetExtendResponsePayload(Resources.KsiService_ExtendResponsePdu_RequestId_1043101455),
                GetExtenderConfigResponsePayload(3, new List <string>()
                {
                    "uri-2-changed"
                }, 1136073602, 2136073600)
            });

            ((TestKsiService)haService.ExtendingServices[1]).ExtendingServiceProtocol.RequestResult = newService.ExtendingServiceProtocol.RequestResult;

            ExtenderConfigChangedEventArgs args = null;

            waitHandle = new ManualResetEvent(false);

            haService.ExtenderConfigChanged += delegate(object sender, ExtenderConfigChangedEventArgs e)
            {
                args = e;
            };

            resultConf = haService.GetExtenderConfig();

            Assert.AreEqual(3, resultConf.MaxRequests, "Unexpected max requests value");
            Assert.AreEqual(1, resultConf.ParentsUris.Count, "Unexpected parent uri count");
            Assert.AreEqual("uri-2-changed", resultConf.ParentsUris[0], "Unexpected parent uri value at position 0");
            Assert.AreEqual(1136073602, resultConf.CalendarFirstTime, "Unexpected calendar first time value");
            Assert.AreEqual(2136073600, resultConf.CalendarLastTime, "Unexpected calendar last time value");

            waitHandle.WaitOne(1000);

            Assert.IsNotNull(args, "ExtenderConfigChangedEventArgs cannot be null.");
            Assert.AreEqual(resultConf, args.ExtenderConfig, "Unexpected ExtenderConfigChangedEventArgs.ExtenderConfig.");
            Assert.IsNull(args.Exception, "ExtenderConfigChangedEventArgs.Exception cannot have value.");
            Assert.AreEqual(haService, args.KsiService, "Unexpected ExtenderConfigChangedEventArgs.KsiService");
        }
        public void HAGetConfigResultsWithSignRequestTest()
        {
            // Test getting aggregator configurations via AggregatorConfigChanged event handler when using Sign method.
            // Testing getting different configurations in a sequence

            HAKsiService haService = GetHAService(
                new List <PduPayload>()
            {
                GetAggregationResponsePayload(Resources.KsiService_AggregationResponsePdu_RequestId_1584727637),
                GetAggregatorConfigResponsePayload(1, 1, 200, 4, new List <string>()
                {
                    "uri-1"
                })
            },
                new List <PduPayload>()
            {
                GetAggregationResponsePayload(Resources.KsiService_AggregationResponsePdu_RequestId_1584727638),
                GetAggregatorConfigResponsePayload(1, 1, 200, 4, new List <string>()
                {
                    "uri-2"
                })
            });

            TestKsiService secondService = (TestKsiService)haService.SigningServices[1];

            secondService.RequestId = 1584727638;

            AggregatorConfig resultConf = null;
            int changeCount             = 0;
            ManualResetEvent waitHandle = new ManualResetEvent(false);

            haService.AggregatorConfigChanged += delegate(object sender, AggregatorConfigChangedEventArgs e)
            {
                resultConf = e.AggregatorConfig;
                changeCount++;
                if (changeCount == 2)
                {
                    waitHandle.Set();
                }
            };

            DataHash      inputHash = new DataHash(Base16.Decode("019f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"));
            IKsiSignature signature = haService.Sign(inputHash);

            Assert.AreEqual(inputHash, signature.InputHash, "Unexpected signature input hash.");
            waitHandle.WaitOne(1000);
            Assert.IsNotNull(resultConf, "Could not get aggregator config using event handler.");

            Assert.AreEqual(1, resultConf.MaxLevel, "Unexpected max level value");
            Assert.IsTrue(resultConf.AggregationAlgorithm == 1 || resultConf.AggregationAlgorithm == 2, "Unexpected algorithm value");
            Assert.AreEqual(200, resultConf.AggregationPeriod, "Unexpected aggregation period value");
            Assert.AreEqual(4, resultConf.MaxRequests, "Unexpected max requests value");
            Assert.AreEqual(1, resultConf.ParentsUris.Count, "Unexpected parent uri count");
            Assert.IsTrue(resultConf.ParentsUris[0] == "uri-1" || resultConf.ParentsUris[0] == "uri-2", "Unexpected parent uri value at position 0");

            // changing aggregation algorithm or parent uri should not change merged config
            TestKsiService newService = (TestKsiService)GetService(new List <PduPayload>()
            {
                GetAggregationResponsePayload(Resources.KsiService_AggregationResponsePdu_RequestId_1584727638),
                GetAggregatorConfigResponsePayload(1, 3, 200, 4, new List <string>()
                {
                    "uri-2-changed"
                })
            });

            secondService.SigningServiceProtocol.RequestResult = newService.SigningServiceProtocol.RequestResult;

            resultConf  = null;
            changeCount = 0;
            haService.Sign(inputHash);
            Thread.Sleep(1000);
            Assert.IsNull(resultConf, "Aggregator config should have not changed (2nd request)");
            Assert.AreEqual(0, changeCount, "Unexpected change count.");

            // changing max level should change merged config
            newService = (TestKsiService)GetService(new List <PduPayload>()
            {
                GetAggregationResponsePayload(Resources.KsiService_AggregationResponsePdu_RequestId_1584727638),
                GetAggregatorConfigResponsePayload(2, 2, 200, 4, new List <string>()
                {
                    "uri-2", "uri-3"
                })
            });

            secondService.SigningServiceProtocol.RequestResult = newService.SigningServiceProtocol.RequestResult;

            waitHandle.Reset();
            resultConf  = null;
            changeCount = 0;

            haService.Sign(inputHash);
            waitHandle.WaitOne(1000);
            Assert.IsNotNull(resultConf, "Could not get aggregator config using event handler (after 3rd sign request).");

            Assert.AreEqual(2, resultConf.MaxLevel, "Unexpected max level value (after 3rd sign request)");
            Assert.IsTrue(resultConf.AggregationAlgorithm == 1 || resultConf.AggregationAlgorithm == 2, "Unexpected algorithm value (after 3rd sign request)");
            Assert.AreEqual(200, resultConf.AggregationPeriod, "Unexpected aggregation period value (after 3rd sign request)");
            Assert.AreEqual(4, resultConf.MaxRequests, "Unexpected max requests value (after 3rd sign request)");
            Assert.AreEqual(1, resultConf.ParentsUris.Count, "Unexpected parent uri count (after 3rd sign request)");
            Assert.IsTrue(resultConf.ParentsUris[0] == "uri-1" || resultConf.ParentsUris[0] == "uri-2", "Unexpected parent uri value at position 0 (after 3rd sign request)");

            // changing aggegation period should change merged config
            newService = (TestKsiService)GetService(new List <PduPayload>()
            {
                GetAggregationResponsePayload(Resources.KsiService_AggregationResponsePdu_RequestId_1584727638),
                GetAggregatorConfigResponsePayload(2, 2, 100, 4, new List <string>()
                {
                    "uri-2", "uri-3"
                })
            });

            secondService.SigningServiceProtocol.RequestResult = newService.SigningServiceProtocol.RequestResult;

            waitHandle.Reset();
            resultConf  = null;
            changeCount = 0;

            haService.Sign(inputHash);
            waitHandle.WaitOne(1000);
            Assert.IsNotNull(resultConf, "Could not get aggregator config using event handler (after 4th sign request).");

            Assert.AreEqual(2, resultConf.MaxLevel, "Unexpected max level value (after 4th sign request)");
            Assert.IsTrue(resultConf.AggregationAlgorithm == 1 || resultConf.AggregationAlgorithm == 2, "Unexpected algorithm value (after 4th sign request)");
            Assert.AreEqual(100, resultConf.AggregationPeriod, "Unexpected aggregation period value (after 4th sign request)");
            Assert.AreEqual(4, resultConf.MaxRequests, "Unexpected max requests value (after 4th sign request)");
            Assert.AreEqual(1, resultConf.ParentsUris.Count, "Unexpected parent uri count (after 4th sign request)");
            Assert.IsTrue(resultConf.ParentsUris[0] == "uri-1" || resultConf.ParentsUris[0] == "uri-2", "Unexpected parent uri value at position 0 (after 4th sign request)");

            // changing max requests should change merged config
            newService = (TestKsiService)GetService(new List <PduPayload>()
            {
                GetAggregationResponsePayload(Resources.KsiService_AggregationResponsePdu_RequestId_1584727638),
                GetAggregatorConfigResponsePayload(2, 2, 200, 5, new List <string>()
                {
                    "uri-2", "uri-3"
                })
            });

            secondService.SigningServiceProtocol.RequestResult = newService.SigningServiceProtocol.RequestResult;

            waitHandle.Reset();
            resultConf  = null;
            changeCount = 0;
            haService.Sign(inputHash);
            waitHandle.WaitOne(1000);

            Assert.IsNotNull(resultConf, "Could not get aggregator config using event handler (after 5th sign request).");

            Assert.AreEqual(2, resultConf.MaxLevel, "Unexpected max level value (after 5th sign request)");
            Assert.IsTrue(resultConf.AggregationAlgorithm == 1 || resultConf.AggregationAlgorithm == 2, "Unexpected algorithm value (after 5th sign request)");
            Assert.AreEqual(200, resultConf.AggregationPeriod, "Unexpected aggregation period value (after 5th sign request)");
            Assert.AreEqual(5, resultConf.MaxRequests, "Unexpected max requests value (after 5th sign request)");
            Assert.AreEqual(1, resultConf.ParentsUris.Count, "Unexpected parent uri count (after 5th sign request)");
            Assert.IsTrue(resultConf.ParentsUris[0] == "uri-1" || resultConf.ParentsUris[0] == "uri-2", "Unexpected parent uri value at position 0 (after 5th sign request)");

            // signing again should not change merged config
            waitHandle.Reset();
            resultConf  = null;
            changeCount = 0;

            haService.Sign(inputHash);
            waitHandle.WaitOne(1000);
            Assert.IsNull(resultConf, "Aggregator config should have not changed (after 6th sign request");
            Assert.AreEqual(0, changeCount, "Unexpected change count.");
        }
        public void HAGetConfigResultsAndRemoveOneTest()
        {
            // A configuration request with 2 successful sub-requests is made.
            // Then a new configuration request is made with 1 successful and 1 unsuccessful sub-requests.
            // Unsuccessful service config should be removed from cache and merged config should be recalculated

            HAKsiService haService = GetHAService(
                new List <PduPayload>()
            {
                GetAggregatorConfigResponsePayload(2, 1, 100, 4, new List <string>()
                {
                    "uri-1"
                })
            },
                new List <PduPayload>()
            {
                GetAggregatorConfigResponsePayload(1, 2, 100, 4, new List <string>()
                {
                    "uri-2"
                })
            });

            ManualResetEvent waitHandle = new ManualResetEvent(false);

            haService.AggregatorConfigChanged += delegate
            {
            };

            AggregatorConfig resultConf = haService.GetAggregatorConfig();

            waitHandle.WaitOne(1000);

            Assert.AreEqual(2, resultConf.MaxLevel, "Unexpected max level value");
            Assert.AreEqual(100, resultConf.AggregationPeriod, "Unexpected aggregation period value");
            Assert.AreEqual(4, resultConf.MaxRequests, "Unexpected max requests value");
            Assert.AreEqual(1, resultConf.ParentsUris.Count, "Unexpected parent uri count");

            // change first service response so that request fails
            ((TestKsiService)haService.SigningServices[0]).SigningServiceProtocol.RequestResult =
                File.ReadAllBytes(Path.Combine(TestSetup.LocalPath, Resources.KsiService_AggregationResponsePdu_RequestId_1584727637));

            // change second service response so that a valid configuration is returned
            TestKsiService newService = (TestKsiService)GetService(new List <PduPayload>()
            {
                GetAggregationResponsePayload(Resources.KsiService_AggregationResponsePdu_RequestId_1584727638),
                GetAggregatorConfigResponsePayload(2, 3, 400, 3, new List <string>()
                {
                    "uri-2-changed"
                })
            });

            ((TestKsiService)haService.SigningServices[1]).SigningServiceProtocol.RequestResult = newService.SigningServiceProtocol.RequestResult;

            AggregatorConfigChangedEventArgs args = null;

            waitHandle = new ManualResetEvent(false);

            haService.AggregatorConfigChanged += delegate(object sender, AggregatorConfigChangedEventArgs e)
            {
                args = e;
            };

            resultConf = haService.GetAggregatorConfig();

            Assert.AreEqual(2, resultConf.MaxLevel, "Unexpected max level value");
            Assert.AreEqual(3, resultConf.AggregationAlgorithm, "Unexpected algorithm value");
            Assert.AreEqual(400, resultConf.AggregationPeriod, "Unexpected aggregation period value");
            Assert.AreEqual(3, resultConf.MaxRequests, "Unexpected max requests value");
            Assert.AreEqual(1, resultConf.ParentsUris.Count, "Unexpected parent uri count");
            Assert.AreEqual("uri-2-changed", resultConf.ParentsUris[0], "Unexpected parent uri value at position 0");

            waitHandle.WaitOne(1000);

            Assert.IsNotNull(args, "AggregatorConfigChangedEventArgs cannot be null.");
            Assert.AreEqual(resultConf, args.AggregatorConfig, "Unexpected AggregatorConfigChangedEventArgs.AggregatorConfig.");
            Assert.IsNull(args.Exception, "AggregatorConfigChangedEventArgs.Exception cannot have value.");
            Assert.AreEqual(haService, args.KsiService, "Unexpected AggregatorConfigChangedEventArgs.KsiService");
        }