AdventureWorks.WebServices.Tests.Controllers.IdentityControllerFixture.ValidateUserNameValidPassword C# (CSharp) Method

ValidateUserNameValidPassword() private method

private ValidateUserNameValidPassword ( ) : void
return void
        public void ValidateUserNameValidPassword()
        {
            var controller = new IdentityController();

            // 1- Get a random password challenge string from the web service.
            const string requestId = "ec609a4f";
            var challengeString = controller.GetPasswordChallenge(requestId);
            Assert.IsFalse(string.IsNullOrEmpty(challengeString));

            // 2 - Hash the challenge string with the correct password and ask the web service to validate the hash.
            var result = controller.GetIsValid("JohnDoe", requestId, CreatePasswordHash("pwd", challengeString));

            // 3- Verify that credentials were validated.
            Assert.IsNotNull(result);
            Assert.AreEqual(result.UserName, "JohnDoe");
        }