Example #1
0
		public void Authenticate_Should_Return_True_User()
		{
			// Arrange
			UserController.UserInfo userInfo = new UserController.UserInfo();
			userInfo.Email = "admin@localhost";
			userInfo.Password = "******";

			_userService.AddUser("admin@localhost", "user", "password1", true, true);
			_userService.Users[0].IsActivated = true;

			// Act
			bool isAuthed = _userController.Authenticate(userInfo);

			// Assert
			Assert.That(isAuthed, Is.True);
		}
        public void Authenticate_Should_Return_True_For_Known_User()
        {
            // Arrange
            UserController.UserInfo info = new UserController.UserInfo()
            {
                Email = ADMIN_EMAIL,
                Password = ADMIN_PASSWORD
            };

            WebApiClient apiclient = new WebApiClient();
            apiclient.Login();

            // Act
            WebApiResponse response = apiclient.Post<UserController.UserInfo>("Authenticate", info);

            // Assert
            Assert.That(response.Content, Is.EqualTo("true"), response);
        }