Ejemplo n.º 1
0
        public void TestUnsuccessfulLoginHandledCorrectly()
        {
            var authService = new AuthServiceMock(false);
            var viewModel   = new LoginViewModel(authService);

            const string username = "******";
            const string password = "******";

            viewModel.Username = username;
            viewModel.Password = password;

            viewModel.LoginCommand.Execute(null);
            Assert.AreEqual("Wrong credentials", viewModel.Message);
        }
Ejemplo n.º 2
0
        public void TestCorrectCredentialsAreSent()
        {
            var authService = new AuthServiceMock(true);
            var viewModel   = new LoginViewModel(authService);

            const string username = "******";
            const string password = "******";

            viewModel.Username = username;
            viewModel.Password = password;

            viewModel.LoginCommand.Execute(null);

            Assert.IsTrue(authService.loginsLog.Any());

            var usedIdentity = authService.loginsLog.First();

            Assert.AreEqual(username, usedIdentity.Username);
            Assert.AreEqual(password, usedIdentity.Password);
        }