コード例 #1
0
 protected void Db(Action <LocalRepository> action)
 {
     Wait.For(null, () =>
     {
         using (var repository = LocalRepository.New(deleteAllDocuments: false))
         {
             repository.Register();
             DomainRegistry.ValidationContext = new ValidationContext(true);
             DomainRegistry.CloudStore        = LocalCloudStore.New(clearContainer: false);
             action(repository);
         }
     });
 }
コード例 #2
0
        public void SetUp()
        {
            Console.WriteLine("Aquiring machine-wide lock ... ");

            try
            {
                var security = new SemaphoreSecurity();
                security.AddAccessRule(new SemaphoreAccessRule("Everyone", SemaphoreRights.FullControl, AccessControlType.Allow));

                bool createdNew_notUsed;
                var  semaphoreName = "Global\\FormUITests";

                lock (typeof(SetUpFixture))
                {
                    DisposeSemaphore();

                    _enforceSingleInstance = new Semaphore(1, 1, semaphoreName, out createdNew_notUsed, security);

                    if (!_enforceSingleInstance.WaitOne(TimeSpan.FromSeconds(240)))
                    {
                        throw new Exception("Could not obtain semaphore: " + semaphoreName);
                    }
                }

                Console.WriteLine("Aquired");

                LocalRepository.VerifyRunning();
                LocalCloudStore.VerifyRunning();
            }
            catch
            {
                TearDown();
                throw;
            }

            TestRegistry.TestHasFailed = false;
        }