Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }