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); } }); }
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; }