public virtual void ValidLoginMustBeRedirectedToClientUrl() { using (IdentityServerTestEnvironment testEnvironment = new IdentityServerTestEnvironment()) { using (RemoteWebDriver driver = testEnvironment.Server.GetWebDriver(new RemoteWebDriverOptions { Uri = @"core/connect/authorize?scope=openid profile user_info&client_id=Test&redirect_uri=http://127.0.0.1/SignIn&response_type=id_token token&state={}&nonce=SgPoeilE1Tub", ClientSideTest = false })) { driver.GetElementById("username").SendKeys("ValidUser1"); driver.GetElementById("password").SendKeys("ValidUser1"); driver.GetElementById("login").Click(); driver.WaitForControlReady(); } Api.Implementations.TestUserService testUserService = TestDependencyManager.CurrentTestDependencyManager.Objects .OfType <Api.Implementations.TestUserService>() .Single(); A.CallTo(() => testUserService.AuthenticateLocalAsync(A <LocalAuthenticationContext> .That.Matches(cntx => cntx.UserName == "ValidUser1" && cntx.Password == "ValidUser1"))) .MustHaveHappened(Repeated.Exactly.Once); // TODO } }
public virtual void LoginWithInValidUserNameAndPasswordUsingCodeMayNotWorksFine() { using (IdentityServerTestEnvironment testEnvironment = new IdentityServerTestEnvironment(useRealServer: false)) { TokenClient tokenClient = testEnvironment.Server.BuildTokenClient("Test2", "secret"); TokenResponse tokenResponse = tokenClient.RequestResourceOwnerPasswordAsync("InValidUser1", "InValidUser1", scope: "openid profile user_info").Result; Assert.IsTrue(tokenResponse.IsError); } }