public bool ValidatePassword(ValidationMessages messages) { if (string.IsNullOrEmpty(client_id)) { messages.Add("ClientId missing. Use the client_id property to set the ClientId."); return(false); } if (string.IsNullOrEmpty(client_secret)) { messages.Add("ClientSecret missing. Use the client_secret property to set the ClientSecret."); return(false); } if (string.IsNullOrEmpty(username)) { messages.Add("Username missing. Use the username property to set the Username."); return(false); } if (string.IsNullOrEmpty(password)) { messages.Add("Password missing. Use the password property to set the Password."); return(false); } return(true); }
public void ValidatePassword() { var messages = new ValidationMessages(); if (string.IsNullOrEmpty(ClientId)) { messages.Add("ClientId missing. Use the client_id property to set the ClientId."); } if (string.IsNullOrEmpty(ClientSecret)) { messages.Add("ClientSecret missing. Use the client_secret property to set the ClientSecret."); } if (string.IsNullOrEmpty(Username)) { messages.Add("Username missing. Use the username property to set the Username."); } if (string.IsNullOrEmpty(Password)) { messages.Add("Password missing. Use the password property to set the Password."); } if (messages.HasErrors) { throw new SoundCloudValidationException(messages); } }
private void CheckForMixedAcTypes(TrsProgramBlock programBlockIn) { foreach (var typeDef in programBlockIn.Statements. Where(stm => stm is TrsTypeDefinition).Cast <TrsTypeDefinition>()) { foreach (var validationInput in typeDef.AcceptedTerms) { var term = validationInput as TrsTypeDefinitionTerm; var acTerm = validationInput as TrsTypeDefinitionAcTerm; if (term != null || acTerm != null) { string strComp = term != null ? term.TermName : acTerm.TermName; var isAc = acTerm != null; if (!isAcTerm.ContainsKey(strComp)) { isAcTerm.Add(strComp, isAc); } if (isAc != isAcTerm[strComp]) { ValidationMessages.Add(new InterpreterResultMessage { Message = string.Format("The '{0}' term may not be an AC and non-AC term at the same time.", strComp), InputEntity = validationInput, MessageType = InterpreterMessageType.Error }); } } } } }
public void CheckJobStatus() { var client = BrightstarService.GetClient(Store.Source.ConnectionString); _transactionJob = client.GetJobInfo(Store.Location, _transactionJob.JobId); if (_transactionJob.JobCompletedOk) { ValidationMessages.Clear(); ValidationMessages.Add(Strings.TransactionSuccess); } else if (_transactionJob.JobCompletedWithErrors) { ValidationMessages.Clear(); ValidationMessages.Add(Strings.TransactionFailed); ValidationMessages.Add(_transactionJob.ExtractJobErrorMessage(true)); Messenger.Default.Send( new ShowDialogMessage("Transaction failed", "Transaction failed with status: " + _transactionJob.StatusMessage, MessageBoxImage.Error, MessageBoxButton.OK), "MainWindow"); } else { _dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, new JobMonitorDelegate(this.CheckJobStatus)); } }
internal bool ValidatePost(ValidationMessages messages) { if (track_id < 1) { messages.Add("TrackId missing. Use the track_id property to set the TrackId of this comment."); return(false); } if (string.IsNullOrEmpty(body)) { messages.Add("Message missing. Use the body property to set your message."); return(false); } return(true); }
public bool ValidatePost(ValidationMessages messages) { if (string.IsNullOrEmpty(title)) { messages.Add("Title missing. Use the title property to set your track title."); return(false); } if (playlist_type == PlaylistType.Other) { messages.Add("Playlist type must not be 'other'."); return(false); } return(true); }
public bool ValidatePost(ValidationMessages messages) { if (string.IsNullOrEmpty(title)) { messages.Add("WebProfile title missing. Use the title property to set the title of this WebProfile."); return(false); } if (string.IsNullOrEmpty(url)) { messages.Add("WebProfile url missing. Use the url property to set the url of this WebProfile."); return(false); } return(true); }
public bool ValidateUpdate(ValidationMessages messages) { if (id < 1) { messages.Add("PlaylistId missing. Use the id property to set the id of this playlist."); return(false); } if (string.IsNullOrEmpty(title)) { messages.Add("Title missing. Use the title property to set your track title."); return(false); } return(true); }
public bool ValidateUpdate(ValidationMessages messages) { if (id < 1) { messages.Add("GroupId missing. Use the id property to set the id of this group."); return(false); } if (string.IsNullOrEmpty(name)) { messages.Add("Name missing. Use the name property to set your group name."); return(false); } return(true); }
protected void LogInvalidRecord(string record, Exception ex = null) { if (ex != null) { var message = string.Empty; if (ex.InnerException != null) { message = ex.InnerException.Message; } else { message = ex.Message; } ValidationMessages.Add($"Error: {message}. Raw record: {record}"); } else { ValidationMessages.Add($"Invalid record: {record}"); } IsParseSuccess = false; // todo: perform log }
public bool ValidateClientCredentials(ValidationMessages messages) { if (string.IsNullOrEmpty(client_id)) { messages.Add("ClientId missing. Use the client_id property to set the ClientId."); return(false); } if (string.IsNullOrEmpty(client_secret)) { messages.Add("ClientSecret missing. Use the client_secret property to set the ClientSecret."); return(false); } return(true); }
public virtual bool CanBuySnack(int position) { ValidationMessages.Clear(); var snackPile = GetSnackPile(position); if (snackPile.Quantity == 0) { ValidationMessages.Add(Constants.NoSnackAvailableToBuy); return(false); } if (snackPile.Price > MoneyInTransaction) { ValidationMessages.Add(Constants.NotEnoughMoneyInserted); return(false); } if (!MoneyInside.CanAllocate(snackPile.Price)) { ValidationMessages.Add(Constants.NotEnoughChange); return(false); } return(true); }
public override void Validate(TrsProgramBlock programBlockIn) { // Check for empty if (programBlockIn.Statements == null || programBlockIn.Statements.Count == 0) { ValidationMessages.Add(new InterpreterResultMessage { Message = "Empty program block.", MessageType = InterpreterMessageType.Warning, InputEntity = programBlockIn }); } // Check types for cyclical definitions ValidateTypeDefinitions(programBlockIn); // Check limit statements ValidateLimitStatements(programBlockIn); // Check statements with sub-validators ValidateSubValidators(programBlockIn); // Check type definitions for mixed AC/non-ac terms with the same name CheckForMixedAcTypes(programBlockIn); }
public void Test_HasErrors() { var errors = new ValidationMessages(); errors.Add("error!"); Assert.That(errors.HasErrors, Is.True); }
public void Test_Add_String() { var errors = new ValidationMessages(); errors.Add("error!"); Assert.Equal("error!", errors.ToString()); }
public void Test_Add_StringBuilder() { var errors = new ValidationMessages(); errors.Add(new StringBuilder("error!")); Assert.That(errors.ToString(), Is.EqualTo("error!")); }
public void OutputsCorrectly() { var messages = new ValidationMessages(); const string expectedError = "Error"; messages.Add(XmlSeverityType.Error, expectedError); Assert.Same(expectedError, messages.ToString()); }
public void ValidateClientCredentials() { var messages = new ValidationMessages(); if (string.IsNullOrEmpty(ClientId)) { messages.Add("ClientId missing. Use the client_id property to set the ClientId."); } if (string.IsNullOrEmpty(ClientSecret)) { messages.Add("ClientSecret missing. Use the client_secret property to set the ClientSecret."); } if (messages.HasErrors) { throw new SoundCloudValidationException(messages); } }
public void Test_With_ErrorMessages() { var messages = new ValidationMessages(); messages.Add("MyMessage"); var ex = new SoundCloudValidationException(messages); Assert.That(ex.Message, Is.EqualTo("MyMessage")); }
public bool ValidatePost(ValidationMessages messages) { if (string.IsNullOrEmpty(name)) { messages.Add("Name missing. Use the name property to set your group name."); return(false); } return(true); }
public bool ValidateUploadArtwork(ValidationMessages messages) { if (id < 1) { messages.Add("PlaylistId missing. Use the id property to set the id of this playlist."); return(false); } return(true); }
public bool ValidateDelete(ValidationMessages messages) { if (id < 1) { messages.Add("WebProfile id missing. Use the id property to set the id of this WebProfile."); return(false); } return(true); }
public bool ValidateLikeUnlike(ValidationMessages messages) { if (id < 1) { messages.Add("TrackId missing. Use the id property to set the id of this track."); return(false); } return(true); }
public bool ValidateGet(ValidationMessages messages) { if (id < 1) { messages.Add("UserId missing. Use the id property to set the id of this user."); return(false); } return(true); }
public bool ValidateDelete(ValidationMessages messages) { if (track_id < 1) { messages.Add("TrackId missing. Use the track_id property to set the TrackId of this comment."); return(false); } return(true); }
public void ValidatePost() { var messages = new ValidationMessages(); if (string.IsNullOrEmpty(Title)) { messages.Add("Title missing. Use the title property to set your track title."); } if (PlaylistType == PlaylistType.Other) { messages.Add("Playlist type must not be 'other'."); } if (messages.HasErrors) { throw new SoundCloudValidationException(messages); } }
public void ValidateUpdate() { var messages = new ValidationMessages(); if (Id < 1) { messages.Add("PlaylistId missing. Use the id property to set the id of this playlist."); } if (string.IsNullOrEmpty(Title)) { messages.Add("Title missing. Use the title property to set your track title."); } if (messages.HasErrors) { throw new SoundCloudValidationException(messages); } }
internal void ValidatePost() { var messages = new ValidationMessages(); if (TrackId < 1) { messages.Add("TrackId missing. Use the track_id property to set the TrackId of this comment."); } if (string.IsNullOrEmpty(Body)) { messages.Add("Message missing. Use the body property to set your message."); } if (messages.HasErrors) { throw new SoundCloudValidationException(messages); } }
public void ValidatePassword() { var messages = new ValidationMessages(); if (string.IsNullOrEmpty(UserName)) { messages.Add("UserName не указан. Используй username свойство для установки UserName."); } if (string.IsNullOrEmpty(Password)) { messages.Add("Password не указан. Используй password свойство для установки Password."); } if (messages.HasErrors) { throw new EasyMSValidationException(messages); } }
/// <summary> /// Validates the specified model is not null /// </summary> /// <param name="modelProperties">The model properties.</param> /// <param name="model">The model.</param> /// <param name="validationMessages">The validation messages.</param> /// <returns></returns> public bool Validate(IModelProperties <TModel> modelProperties, TModel model, ValidationMessages validationMessages) { bool isValid = !Equals(model, null); if (!isValid) { string message = string.Format("Null model specified. Type='{0}'", typeof(TModel)); validationMessages.Add(message); } return(isValid); }