public void SetUp() { _storage = new MongoDbWikiPersister { DatabaseName = "QorpentIntegrationTests", CollectionName = "MongoDbWikiTestsTests", ConnectionString = Environment.GetEnvironmentVariable("LOCALMONGOCS", EnvironmentVariableTarget.Machine) ?? "mongodb://localhost" }; _app = new Application(); _app.Container.Register(new ComponentDefinition<IPrincipalSource, StubPrincipalSource>()); _app.Principal.SetCurrentUser(new StubClaimsPrincipal { Identity = new StubIdentity { Name = Guid.NewGuid().ToString() } }); _storage.SetApplication(_app); }
public void GetLockTask(bool isFirst) { var storage = new MongoDbWikiPersister { DatabaseName = "Zefs", CollectionName = "main" }; storage.SetApplication(_app); var locked = storage.GetLock("test"); if (isFirst) { Assert.IsTrue(locked); } else { Assert.IsFalse(locked); } }