public void ConnectODSWrongAuth() { LoginData login = new LoginData(DefaultLoginData); login.Password = login.Password + "foobar"; //arbitrary pw modification try { Shell.Execute(SimpleConnectCommand(login)); Assert.True(false, "Login seemed to work with wrong password!"); } catch (CmdletInvocationException exception) { var realException = exception.InnerException as RequestFailedException; Assert.IsNotNull(realException, "Wrong exception thrown for failed login"); Assert.True(realException.Message.Contains("Error Code: 2"), String.Format("Wrong error for failed login: {0}", realException.Message)); } }
// General helper stuff internal string SimpleConnectCommand(LoginData login) { return String.Join(" ", new string[] { CmdletName(typeof(ConnectODSCommand)), "-Host", SingleQuote(login.URL), "-Username", SingleQuote(login.UserName), "-Password", SingleQuote(login.Password) }); }
public LoginData(LoginData login) { URL = login.URL; UserName = login.UserName; Password = login.Password; }