private bool TryLoginToApi() { try { if (ValidateLoginData(tbApiServerUrl.Text, tbApiUserName.Text, tbApiPassword.Text, tbLicenseCode.Text)) { SetUpXmlApiSettings(); var testApiLoginCommand = new TestApiLoginCommand(Program.Container.Resolve <ITestLoginXmlApiService>()); var result = testApiLoginCommand.Execute(); if (!result) { ShowProgressBarStatus(JobStatus.Failed); _uiMessages.TestLoginMessage(false); } return(result); } return(false); } catch (XmlApiLoginException ex) { _logger.Error(ex.Message, ex); ShowProgressBarStatus(JobStatus.Failed); _uiMessages.TestLoginMessage(false); return(false); } }
public void TestThanTestApiLoginCommandReturnFalseIfXmlApiServiceReturnsFalse() { _testLoginXmlApiService.Setup(w => w.Test()).Returns(() => false); var testApiLoginCommand = new TestApiLoginCommand(_testLoginXmlApiService.Object); var result = testApiLoginCommand.Execute(); Assert.AreEqual(false, result); }