public void LoadReportsMissingLineNumberCode(string fileName, bool throwsException) { SetupSut(); _mockExpressionEvaluator.Setup(mee => mee.GetExpression()).Returns(new Accumulator(fileName)); BasicException exception = Test.Throws <BasicException>(() => _sut.Execute(_mockTokeniser.Object), throwsException); if (throwsException) { StringAssert.Contains(exception.ErrorMessage, "LAST GOOD LINE WAS 20"); } }
public void LoadReportsExceptionCode(string fileName, bool throwsException) { SetupSut(); _mockExpressionEvaluator.Setup(mee => mee.GetExpression()).Returns(new Accumulator(fileName)); BasicException exception = Test.Throws <BasicException>(() => _sut.Execute(_mockTokeniser.Object), throwsException); if (throwsException) { StringAssert.Contains(exception.ErrorMessage, "Could not find file \'" + fileName + "\'"); } }
private bool validateDataSource(DataSource viewModel, out Exception exception) { exception = null; if (viewModel == null) { exception = new BasicException("Invalid request.", "viewModel is null."); return(false); } if (string.IsNullOrWhiteSpace(viewModel.Name)) { exception = new BasicException("The name field is required.", "Name field is empty in Data Source request."); return(false); } return(true); }
private bool validateCreateProjectRequest(Project viewModel, out Exception ex) { ex = null; if (viewModel == null) { ex = new BasicException("Invalid data was submitted. Please try again.", "CreateProjectViewModel is null."); return(false); } if (string.IsNullOrWhiteSpace(viewModel.Name)) { ex = new BasicException("Project Name is required. Please try again.", "CreateProjectViewModel.Project.Name is null or empty."); return(false); } if (string.IsNullOrWhiteSpace(viewModel.Description)) { ex = new BasicException("Project Description is required. Please try again.", "CreateProjectViewModel.Project.Name is null or empty."); return(false); } return(true); }
private bool validateConnection(DataConnectionInfo connectionInfo, out Exception exception) { exception = null; if (connectionInfo == null) { exception = new BasicException("Invalid request.", "viewModel is null."); return(false); } if (string.IsNullOrWhiteSpace(connectionInfo.ServerName)) { exception = new BasicException("The 'Server Name' field is required.", "Name field is empty in Data Source request."); return(false); } if (string.IsNullOrWhiteSpace(connectionInfo.DatabaseName)) { exception = new BasicException("The 'Database Name' field is required.", "Name field is empty in Data Source request."); return(false); } if (string.IsNullOrWhiteSpace(connectionInfo.Username)) { exception = new BasicException("The 'Username' field is required.", "Name field is empty in Data Source request."); return(false); } if (string.IsNullOrWhiteSpace(connectionInfo.Password)) { exception = new BasicException("The 'Password' field is required.", "Name field is empty in Data Source request."); return(false); } return(true); }