Пример #1
0
        public bool IsLoginRegistered(string email)
        {
            var key = GetKey(email);

            return(_storage
                   .Get(key)
                   .Convert(i => i.Logins.ContainsKey(email), false));
        }
Пример #2
0
        public void get_by_key_does_not_exist()
        {
            //GIVEN
            var result = _reader.Get(Guid.NewGuid());

            //WHEN
            Assert.IsFalse(result.HasValue);
        }
Пример #3
0
        public bool IsValidUser(GoalId goalId, string user)
        {
            Maybe <UserGoalsView> view;

            view = _reader.Get(goalId);
            if (!view.HasValue)
            {
                return(false);
            }
            return(view.Value.User.Equals(user));
        }
Пример #4
0
        Maybe <SessionIdentity> VerifyAndLoad(AuthInfo info)
        {
            var maybe = _view.Get(info.Login);

            if (!maybe.HasValue)
            {
                return(Maybe <SessionIdentity> .Empty);
            }
            var view = maybe.Value;

            // Stored token does not match actual token.
            // Crash this one
            if (!string.Equals(view.Token, info.Token))
            {
                return(Maybe <SessionIdentity> .Empty);
            }
            return(new SessionIdentity(info.Login, view.Security, view.Display, info.ToCookieString(), view.Permissions,
                                       info.Token));
        }
Пример #5
0
        public async Task UpdateAnExistingDocument()
        {
            //Init
            var id = _sampleDocumentId;
            var existingDocument = _reader.Get(id);

            //Verify
            Assert.IsNotNull(existingDocument);
            var newCorrectAnswer = "Sample_Answer_" + Guid.NewGuid().ToString();

            existingDocument.CorrectAnswer = newCorrectAnswer;

            //Action
            await _writer.CreateOrUpdateAsync(existingDocument);

            var document = await _reader.GetAsync(id);

            //Assert
            Assert.IsNotNull(document);
            Assert.AreEqual(newCorrectAnswer, document.CorrectAnswer);
        }
Пример #6
0
 public List <CategoryDto> Get()
 {
     return(_reader.Get());
 }
Пример #7
0
 public List <QuestionDto> Get()
 {
     return(_reader.Get());
 }