private IUserIdentity Validate(TokenDto token) { if (DateTime.UtcNow - token.Created > expiration) { db.Delete(token); return(null); } return(new UserIdentity { UserName = token.Username }); }
public void TestGetSetDocs() { var service = new CouchDBService(); var toSet = new Data { value = "Hello world" }; var setId = service.Set(toSet); var getResult = service.Get<Data>(setId); Assert.AreEqual(toSet.value, getResult.value); var allTests = service.GetByDocType<Data>(getResult.docType).ToList(); Assert.IsTrue(allTests.Count() > 0); service.Delete(allTests); var notFound = service.Get<Data>(setId); Assert.IsNull(notFound); }
public void TestGetSetDocs() { var service = new CouchDBService(); var toSet = new Data { value = "Hello world" }; var setId = service.Set(toSet); var getResult = service.Get <Data>(setId); Assert.AreEqual(toSet.value, getResult.value); var allTests = service.GetByDocType <Data>(getResult.docType).ToList(); Assert.IsTrue(allTests.Count() > 0); service.Delete(allTests); var notFound = service.Get <Data>(setId); Assert.IsNull(notFound); }