public async Task GetUserMessagesTask_GetUserMessagesCallsDbContext_UserCorrect()
        {
            var testUser        = TestModelFactory.CreateUserModel();
            var testMessageList = new List <MessageModel>()
            {
                TestModelFactory.CreateMessageModel("Test", MessageType.LessorMessage)
            };

            _fakeDbToAppModelConverter.Convert(Arg.Any <List <Message> >()).Returns(testMessageList);
            _fakeDbContext.GetUser(Arg.Any <string>(), Arg.Any <Guid>()).Returns(new User()
            {
                Email = testUser.Email,
            });

            await _uut.GetUserMessagesTask(testUser, 10);

            await _fakeDbContext.Received().GetMessages(Arg.Is <User>(u => u.Email == testUser.Email), Arg.Any <List <Message> >(), Arg.Any <int>());
        }
Example #2
0
        public async Task GetUser_UserFromDbConverted_UserReturnedCorrectly(string email, string password)
        {
            var pwd = password.ConvertToSecureString();

            _fakeDbContext.GetUser(Arg.Any <string>(), Arg.Any <string>())
            .Returns(new User()
            {
                Email    = email,
                Password = password
            });

            await _dbQuerier.RegisterUserTask(email, pwd);

            var userResult = await _dbQuerier.GetUserTask(email, pwd);

            Assert.That(userResult.Email, Is.EqualTo(email));
        }