示例#1
0
        public void Should_detect_repository_updates()
        {
            using (var notificationService = new RepositoryUpdatedNotificationService(repository))
            {
                var isNotified = new AutoResetEvent(false);

                notificationService.NotifyRepositoryUpdated += (repo) =>
                {
                    isNotified.Set();
                };

                var insurancePolicy = Xenios.Test.Helpers.InsurancePolicyHelper.CreateInsurancePolicies(1);

                repository.SaveAll(insurancePolicy);
                var isNotifiedSet = isNotified.WaitOne(Constants.WaitTimeOut);

                Assert.IsTrue(isNotifiedSet, "NotifyRepositoryUpdated was not called");
            }
        }
        public void Should_detect_repository_updates()
        {
            using (var notificationService =  new RepositoryUpdatedNotificationService(repository))
            {
                var isNotified = new AutoResetEvent(false);

                notificationService.NotifyRepositoryUpdated += (repo) =>
                    {
                        isNotified.Set();
                    };

                var insurancePolicy = Xenios.Test.Helpers.InsurancePolicyHelper.CreateInsurancePolicies(1);

                repository.SaveAll(insurancePolicy);
                var isNotifiedSet = isNotified.WaitOne(Constants.WaitTimeOut);

                Assert.IsTrue(isNotifiedSet, "NotifyRepositoryUpdated was not called");
            }
        }