示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }