public string Login(string username) { var token = Cryptography.GenerateToken(); var tokenDto = new TokenDto { Token = PasswordHash.CreateHash(token), Created = DateTime.UtcNow, Username = username }; db.Set <TokenDto>(tokenDto); return(token); }
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); }