public void TestNoProjectKey() { String args = "-cp \"e:\\dummy\\Documents\\Visual Studio 2010\\Addins\\vssonar-cli.jar\" com.tekla.vssonar.VssonarCli -solution_path e:\\dummy -username _ -password _ -cmd auth_sonar"; List<string> lines = new List<string>(); MockExecutor executor = new MockExecutor(); SonarInterface sonarCommands = new SonarInterface(executor, "e:\\dummy", "e:\\dummy"); executor.setExpectations("java", args); lines.Add("<project key not defined>"); executor.setReturnValue(lines); Assert.AreEqual(sonarCommands.AuthenticateUserAndValidateConfig("_", "_"), SonarInterface.CONFIG_ERROR_NO_PROJECT_KEY); }
public void TestAuthenticateFails() { String args = "-cp \"e:\\dummy\\Documents\\Visual Studio 2010\\Addins\\vssonar-cli.jar\" com.tekla.vssonar.VssonarCli -solution_path e:\\dummy -username _ -password _ -cmd auth_sonar"; List<string> lines = new List<string>(); MockExecutor executor = new MockExecutor(); SonarInterface sonarCommands = new SonarInterface(executor, "e:\\dummy", "e:\\dummy"); executor.setExpectations("java", args); lines.Add("Authentication Failed"); executor.setReturnValue(lines); Assert.AreEqual(sonarCommands.AuthenticateUserAndValidateConfig("_", "_"), SonarInterface.AUTH_FAIL); }