public void ConstructorWithNullStringArgumentCreatesEmptyStringErrorMessage() { // Act ModelError modelError = new ModelError((string)null); // Assert Assert.Equal(String.Empty, modelError.ErrorMessage); }
/// <summary> /// Gets the <see cref="IORMExtendableElement"/> that the extension <see cref="ModelError"/> specified /// by <paramref name="extensionError"/> is attached to. /// </summary> public static IORMExtendableElement GetExtendedErrorOwnerElement(ModelError extensionError) { if (extensionError == null) { throw new ArgumentNullException("extensionError"); } return (IORMExtendableElement)DomainRoleInfo.GetLinkedElement(extensionError, ORMModelElementHasExtensionModelError.ExtensionModelErrorDomainRoleId); }
private static string GetUserErrorMessageOrDefault(HttpContextBase httpContext, ModelError error, ModelState modelState) { if (!String.IsNullOrEmpty(error.ErrorMessage)) { return error.ErrorMessage; } if (modelState == null) { return null; } string attemptedValue = (modelState.Value != null) ? modelState.Value.AttemptedValue : null; return String.Format(CultureInfo.CurrentCulture, GetInvalidPropertyValueResource(httpContext), attemptedValue); }
/// <summary> /// Adds the extension <see cref="ModelError"/> specified by <paramref name="extensionError"/> to the /// <see cref="IORMExtendableElement"/> specified by <paramref name="extendedElement"/>. /// </summary> public static void AddExtensionModelError(IORMExtendableElement extendedElement, ModelError extensionError) { if (extendedElement == null) { throw new ArgumentNullException("extendedElement"); } if (extensionError == null) { throw new ArgumentNullException("extensionError"); } extendedElement.ExtensionModelErrorCollection.Add(extensionError); }
public void ConstructorWithExceptionAndStringArguments() { // Arrange Exception ex = new Exception("some message"); // Act ModelError modelError = new ModelError(ex, "some other message"); // Assert Assert.Equal("some other message", modelError.ErrorMessage); Assert.Same(ex, modelError.Exception); }
public void ConstructorWithExceptionArgument() { // Arrange Exception ex = new Exception("some message"); // Act ModelError modelError = new ModelError(ex); // Assert Assert.Equal(String.Empty, modelError.ErrorMessage); Assert.Same(ex, modelError.Exception); }
public static string GetErrorMessage(this ModelError input) { if (input == null) { return(string.Empty); } if (!string.IsNullOrWhiteSpace(input.ErrorMessage)) { return(input.ErrorMessage); } if (input.Exception != null) { return(input.Exception.Message); } return(string.Empty); }
public void ProcessDto_RequiredFieldNull_RaisesModelErrorWithMessage() { // Arrange Person model = new Person(); ModelMetadata containerMetadata = GetMetadataForObject(model); HttpActionContext context = ContextUtil.CreateActionContext(); ModelBindingContext bindingContext = new ModelBindingContext { ModelMetadata = containerMetadata, ModelName = "theModel" }; ComplexModelDto dto = new ComplexModelDto(containerMetadata, containerMetadata.Properties); TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder(); // Make ValueTypeRequired invalid. ModelMetadata propertyMetadata = dto.PropertyMetadata.Single(p => p.PropertyName == "ValueTypeRequired"); dto.Results[propertyMetadata] = new ComplexModelDtoResult(null, new ModelValidationNode(propertyMetadata, "theModel.ValueTypeRequired")); // Act testableBinder.ProcessDto(context, bindingContext, dto); // Assert ModelStateDictionary modelStateDictionary = bindingContext.ModelState; Assert.False(modelStateDictionary.IsValid); Assert.Equal(1, modelStateDictionary.Count); // Check ValueTypeRequired error. ModelState modelState; Assert.True(modelStateDictionary.TryGetValue("theModel.ValueTypeRequired", out modelState)); Assert.Equal(1, modelState.Errors.Count); ModelError modelError = modelState.Errors[0]; Assert.Null(modelError.Exception); Assert.NotNull(modelError.ErrorMessage); Assert.Equal("Sample message", modelError.ErrorMessage); }
public static string GetModelErrorMessageOrDefault( ModelError modelError, ModelStateEntry containingEntry, ModelExplorer modelExplorer) { Debug.Assert(modelError != null); Debug.Assert(containingEntry != null); Debug.Assert(modelExplorer != null); if (!string.IsNullOrEmpty(modelError.ErrorMessage)) { return(modelError.ErrorMessage); } // Default in the ValidationMessage case is a fallback error message. var attemptedValue = containingEntry.AttemptedValue ?? "null"; return(modelExplorer.Metadata.ModelBindingMessageProvider.ValueIsInvalidAccessor(attemptedValue)); }
private static ValidationErrorCode ToValidationErrorCode(ModelError error) { if (error.Exception != null) { return(ValidationErrorCode.Invalid); } if (string.IsNullOrWhiteSpace(error.ErrorMessage)) { return(ValidationErrorCode.Invalid); } if (error.ErrorMessage.Contains("required")) { return(ValidationErrorCode.MissingField); } return(ValidationErrorCode.Invalid); }
public void ProcessDto_RequiredFieldMissing_RaisesModelErrorWithMessage() { // Arrange Person model = new Person(); ModelMetadata containerMetadata = GetMetadataForObject(model); HttpActionContext context = ContextUtil.CreateActionContext(); ModelBindingContext bindingContext = new ModelBindingContext { ModelMetadata = containerMetadata, ModelName = "theModel" }; // Set no properties though ValueTypeRequired (a non-Nullable struct) property is required. ComplexModelDto dto = new ComplexModelDto( containerMetadata, containerMetadata.Properties ); TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder(); // Act testableBinder.ProcessDto(context, bindingContext, dto); // Assert ModelStateDictionary modelStateDictionary = bindingContext.ModelState; Assert.False(modelStateDictionary.IsValid); Assert.Single(modelStateDictionary); // Check ValueTypeRequired error. ModelState modelState; Assert.True( modelStateDictionary.TryGetValue("theModel.ValueTypeRequired", out modelState) ); ModelError modelError = Assert.Single(modelState.Errors); Assert.Null(modelError.Exception); Assert.NotNull(modelError.ErrorMessage); Assert.Equal("Sample message", modelError.ErrorMessage); }
private static string ToValidationErrorCode(ModelError error) { if (error.Exception != null) { return("invalid"); } if (string.IsNullOrWhiteSpace(error.ErrorMessage)) { return("invalid"); } if (error.ErrorMessage.Contains("required")) { return("missing-field"); } return("invalid"); }
static string?GetUserErrorMessageOrDefault(ModelError error, ModelState?modelState) { if (!String.IsNullOrEmpty(error.ErrorMessage)) { return(error.ErrorMessage); } if (modelState is null) { return(null); } string?attemptedValue = modelState.Value?.AttemptedValue; string messageFormat = XcstWebConfiguration.Instance.EditorTemplates.DefaultValidationMessage?.Invoke() ?? "The value '{0}' is invalid."; return(String.Format(CultureInfo.CurrentCulture, messageFormat, attemptedValue)); }
public static ResponseErrorModel ToModel(this ModelError error, string field) { var model = new ResponseErrorModel { Field = field }; var codedMessage = error.ErrorMessage.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries); if (codedMessage.Length == 2) { model.Error = codedMessage[0]; model.ErrorDescription = codedMessage[1]; } else { model.ErrorDescription = error.ErrorMessage; } return(model); }
private void buttonDetailsReservations_Click(object sender, EventArgs e) { if (dataGridViewReservations.SelectedRows.Count == 1) { DialogResult result; FormReservationDetails form = new FormReservationDetails(); form.CurrentClient = CurrentClient; try { form.LoadReception(((GetReservedReception_Result)dataGridViewReservations.SelectedRows[0].DataBoundItem).ReceptionId); result = form.ShowDialog(); if (result == DialogResult.OK) { PopulateReceptions(); } } catch (Exception ex) { ModelError modelError = new ModelError(ex); MessageBox.Show(modelError.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
public void SetAttemptedValueUsesExistingModelStateIfPresent() { // Arrange ModelStateDictionary dictionary = new ModelStateDictionary(); dictionary.AddModelError("some key", "some error"); Exception ex = new Exception(); // Act dictionary.SetModelValue("some key", HtmlHelperTest.GetValueProviderResult("some value", "some value")); // Assert Assert.Single(dictionary); ModelState modelState = dictionary["some key"]; ModelError error = Assert.Single(modelState.Errors); Assert.Equal("some error", error.ErrorMessage); Assert.Equal("some value", modelState.Value.ConvertTo(typeof(string))); }
public ActionResult <ClienteViewModel> Adicionar([FromBody] ClienteViewModel clienteViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelError.GetErrorModelState(ModelState))); } var cliente = _mapper.Map <Cliente>(clienteViewModel); if (!_clienteService.Adicionar(cliente)) { return(BadRequest(ModelError.GetErrorValidacao(_notificador))); } var clienteViewModelResult = _mapper.Map <ClienteViewModel>(cliente); return(Ok(clienteViewModelResult)); }
public override Object ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) { var jobj = JObject.Load(reader); var model = new ModelError(); var array = jobj.Value <JArray>("property"); foreach (var item in array) { switch (item.Value <string>("-key")) { case "Message": // Should checking if item["#value"] null model.Message = item.Value <string>("#value"); break; case etc: //write your code } } return(model); }
private bool ActivateError(ModelElement selectedElement, ModelError error, DomainClassInfo domainClass) { ORMModelErrorActivator activator; if (myActivators.TryGetValue(domainClass.ImplementationClass, out activator)) { if (activator((IORMToolServices)myStore, selectedElement, error)) { return(true); } } // See if anything on a base type can handle it. This maximizes the chances of finding a handler. // UNDONE: Do we want both the 'registerDerivedTypes' parameter on RegisterErrorActivator and this recursion? domainClass = domainClass.BaseDomainClass; if (domainClass != null) { return(ActivateError(selectedElement, error, domainClass)); } return(false); }
private static string GetErrorMessage(ModelError modelError) { var errorMessage = modelError.ErrorMessage; if (modelError.Exception != null) { var exceptionMessage = modelError.Exception.Message; if (String.IsNullOrEmpty(errorMessage)) { errorMessage = exceptionMessage; } else { errorMessage += Environment.NewLine + exceptionMessage; } } return(errorMessage); }
private void buttonStarter_Click(object sender, EventArgs e) { FormSelectDish form = new FormSelectDish(); DialogResult result; try { form.PopulateList(CurrentReception.ReceptionId, DishTypeStarter, CurrentClient); result = form.ShowDialog(); if ((result == DialogResult.OK) && (form.SelectedDishId != null)) { using (ProjetSGBDEntities context = new ProjetSGBDEntities()) { _starter = context.Dish.Where(dish => dish.DishId == form.SelectedDishId).First(); textBoxStarter.Text = _starter.Name; } } } catch (Exception ex) { ModelError modelError = new ModelError(ex); MessageBox.Show(modelError.Message, "Erreur fatale!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private static Dictionary <string, object> SerializeModelState(ModelStateEntry modelState) { List <string> errors = new List <string>(); for (int i = 0; i < modelState.Errors.Count; i++) { ModelError modelError = modelState.Errors[i]; string errorText = ValidationHelpers.GetModelErrorMessageOrDefault(modelError); if (!string.IsNullOrEmpty(errorText)) { errors.Add(errorText); } } Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary["errors"] = errors.ToArray(); return(dictionary); }
/// <summary> /// Implements IModelErrorActivation.ActivateModelError /// </summary> protected new bool ActivateModelError(ModelError error) { RingConstraintTypeNotSpecifiedError ringTypeError; bool retVal = true; if (null != (ringTypeError = error as RingConstraintTypeNotSpecifiedError)) { Store store = Store; RingConstraint constraint = ringTypeError.RingConstraint; EditorUtility.ActivatePropertyEditor( (store as IORMToolServices).ServiceProvider, DomainTypeDescriptor.CreatePropertyDescriptor(constraint, RingConstraint.RingTypeDomainPropertyId), true); } else { retVal = base.ActivateModelError(error); } return(retVal); }
public string ConnectPUT(string objeto, string Base2, string codigo) { try { using (var client = new HttpClient()) { var task = Task.Run(async() => { return(await client.PutAsync( URL_API + Base2 + codigo, new StringContent(objeto, Encoding.UTF8, "application/json") )); } ); HttpResponseMessage message = task.Result; if (message.StatusCode == System.Net.HttpStatusCode.NoContent) { return("1"); } else if (message.StatusCode == System.Net.HttpStatusCode.NotFound) { return("El Registro no se encuentra en nuestra Base de datos"); } else { var task2 = Task <string> .Run(async() => { return(await message.Content.ReadAsStringAsync()); }); string mens = task2.Result; ModelError error = JsonConvert.DeserializeObject <ModelError>(mens); return(error.Exceptionmessage); } } } catch (Exception ex) { throw ex; } }
public string ConnectPOST(string objeto, string Base2) { try { using (var client = new HttpClient()) { var task = Task.Run(async() => { return(await client.PostAsync( URL_API + Base2, new StringContent(objeto, Encoding.UTF8, "application/json") )); } ); HttpResponseMessage message = task.Result; if (message.StatusCode == System.Net.HttpStatusCode.Created) { return("1"); } else if (message.StatusCode == System.Net.HttpStatusCode.Conflict) { return("Ya hay un registro con esa informacion"); } else { var task2 = Task <string> .Run(async() => { return(await message.Content.ReadAsStringAsync()); }); string mens = task2.Result; ModelError error = JsonConvert.DeserializeObject <ModelError>(mens); return(error.Exceptionmessage); } } } catch (Exception ex) { throw ex; } }
public async Task <ActionResult <UsuarioViewModel> > Adicionar([FromBody] UsuarioViewModel usuarioViewModel) { if (!ModelState.IsValid) { return(BadRequest(new ResultViewModel(ModelError.GetErrorModelState(ModelState, _notificador)))); } Usuario usuario = _mapper.Map <Usuario>(usuarioViewModel); await _usuarioService.AdicionarAsync(usuario); if (_notificador.TemNotificacao()) { return(BadRequest(ModelError.GetErrorValidacao(_notificador))); } usuario.Password = "******"; ResultViewModel resultViewModel = new ResultViewModel(usuario); return(Ok(resultViewModel)); }
public async Task <ActionResult <List <RelatorioQtdEntradaSaidaHoraViewModel> > > RelatorioEntradaSaidaVeiculoHoraAsync(Guid id) { try { List <QtdEntradaSaidaHora> result = await _relatorioService.QtdEntradaSaidaHoraDTO(id); if (result == null) { return(BadRequest(ModelError.GetErrorValidacao(_notificador))); } List <RelatorioQtdEntradaSaidaHoraViewModel> relatorioQtdEntradaSaidaHoraViewModel = _mapper.Map <List <RelatorioQtdEntradaSaidaHoraViewModel> >(result); return(Ok(relatorioQtdEntradaSaidaHoraViewModel)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, "Ocorreu um erro interno no servidor: " + ex.Message)); } }
private void FormNewReservation_Load(object sender, EventArgs e) { if (CurrentClient != null) { try { using (ProjetSGBDEntities context = new ProjetSGBDEntities()) { IQueryable <GetReservableReception_Result> Receptions = context.GetReservableReception(CurrentClient.Id); foreach (GetReservableReception_Result rec in Receptions) { comboBoxReception.Items.Add(new ReceptionSelection(rec.ReceptionId, rec.DisplayName())); } comboBoxReception.DisplayMember = "DisplayName"; } } catch (Exception ex) { ModelError modelError = new ModelError(ex); MessageBox.Show(modelError.Message, "Erreur fatale!", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = DialogResult.Abort; Close(); } } }
/// <summary> /// Get any not empty error message /// </summary> private static string GetErrorMessage(ModelError error) { if (error == null) { return(string.Empty); } else if (!string.IsNullOrEmpty(error.ErrorMessage)) { return(error.ErrorMessage); } else { // Get message of inner exception Exception ex = error.Exception; while (ex != null && ex.InnerException != null) { ex = ex.InnerException; } return(ex?.Message ?? string.Empty); } }
private static Error FromModelError(ModelError modelError, string attributePath, bool includeExceptionStackTraceInErrors) { var error = new Error(HttpStatusCode.UnprocessableEntity) { Title = "Input validation failed.", Detail = modelError.ErrorMessage, Source = attributePath == null ? null : new ErrorSource { Pointer = attributePath } }; if (includeExceptionStackTraceInErrors && modelError.Exception != null) { error.Meta.IncludeExceptionStackTrace(modelError.Exception.Demystify()); } return(error); }
public ActionResult Index() { int USERID = int.Parse(new JavaScriptSerializer().Serialize(Session["userid"])); GameLogicBLL gameService = new GameLogicBLL(); if (Session["user"] != null) { Globals.Grid = gameService.FindGrid(USERID); if (Globals.Grid == null) { Globals.Grid = gameService.CreateGrid(25, 25, USERID); } } else { ModelError e = new ModelError("You must be logged in to access this page."); } return(View("Index", Globals.Grid)); }
private void buttonDelete_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Êtes-vous sûr de vouloir supprimer la réservation " + CurrentReception.ReceptionName + "?", "Confirmation de suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { try { using (ProjetSGBDEntities context = new ProjetSGBDEntities()) { context.DeleteReservation(CurrentReception.ReceptionId, CurrentClient.Id, CurrentReception.ModifiedAt); } } catch (Exception ex) { ModelError modelError = new ModelError(ex); MessageBox.Show(modelError.Message, "Erreur fatale!", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = DialogResult.None; } } else { DialogResult = DialogResult.None; } }
/// <summary> /// Implements <see cref="IProxyDisplayProvider.ElementDisplayedAs"/> /// </summary> protected object ElementDisplayedAs(ModelElement element, ModelError forError) { Role role; FactType factType; //((Role)ModelElement).FactType == ((FactType)element).ImpliedByObjectification.NestedFactType if (null != (role = element as Role)) { return(((FactTypeShape)ParentShape).GetDiagramItem(role)); } else if (null != (factType = element as FactType)) { Objectification objectification; if (null != (objectification = factType.ImpliedByObjectification) && null != (role = (Role)ModelElement) && role.FactType == objectification.NestedFactType) { return(((FactTypeShape)ParentShape).GetDiagramItem(role)); } } return(null); }
public static MvcHtmlString AppCheckBox(this HtmlHelper htmlHelper, string name, bool isChecked, object htmlAttributes) { var control = new RenderCheckBox(); control.Name = name; if (isChecked) { control.Checked = isChecked.ToString(); } HtmlAttributes(control, htmlAttributes); ModelError modelError = htmlHelper.ViewData.ModelState.Where(w => w.Key == name).SelectMany(m => m.Value.Errors).FirstOrDefault(); if (modelError != null) { control.HtmlValidateString = MvcHtmlString.Create("<span class='validation_wrapper customValidation'><span>" + modelError.ErrorMessage + "</span></span>"); } return(MvcHtmlString.Create(control.ToString())); }
/// <summary> /// Control Validate Before Edit /// If CurPage = "1" is GeneralMemberType must to validate birthday before submit /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnOk_Click(object sender, EventArgs e) { //General BirthDay Validation //CurrentPage Check if ((this.CurPage != null) && (this.CurPage != "")) { //PersonGeneral if (this.CurPage.Equals("1")) { //Control Validation //DTO.ResponseMessage<bool> res = this.ControlValidationBeforeSubmit(this.Page); DTO.ResponseMessage <bool> resBirthDay = this.DateValidation(PersonGeneral.TextboxBirthDay.Text); if ((resBirthDay.ResultMessage == false) || (resBirthDay.IsError)) { ModelError.ShowMessageError = resBirthDay.ErrorMsg; ModelError.ShowModalError(); return; } } //Control Validation DTO.ResponseMessage <bool> res = this.ControlValidationBeforeSubmit(this.Page); if (res.ResultMessage == true) { if (OkRegister_Click != null) { OkRegister_Click(sender, e); } } if ((res.ResultMessage == false) || (res.IsError)) { ModelError.ShowMessageError = res.ErrorMsg; ModelError.ShowModalError(); return; } } //PnlAddButton.Visible = false; }
public ContentResult SignUp(SignUpModel model) { if (!ModelState.IsValid) { ModelError err = ModelState.Values.Where(x => x.Errors.Count() != 0).First().Errors[0]; return(Content(err.ErrorMessage, "text/html")); } try { AccountModel account = new AccountModel(); account.Accounts = new List <AccountModel>(); account.Posts = new List <PostModel>(); account.Notifications = new List <NotificationModel>(); account.Username = model.Usernname; account.Password = model.Password.ToMD5(); account.FullName = model.Fullname; account.Phone = model.Phone; account.Email = model.Email; account.IdCard = model.IdCard; account.Address = model.Address; account.WardId = model.WardId; account.Type = model.UserType; account.ApproverId = 1; using (var db = new DBContext()) { var acc = (from a in db.Accounts where a.Username == account.Username select a).FirstOrDefault(); if (acc != null) { return(Content("Tài khoản đã tồn tại", "text/html")); } db.Accounts.Add(account); db.SaveChanges(); } } catch (Exception ex) { return(Content(ex.Message, "text/html")); } return(Content("<script>window.location.href='/Account/SignIn'</script>", "text/javascript")); }
object IProxyDisplayProvider.ElementDisplayedAs(ModelElement element, ModelError forError) { return ElementDisplayedAs(element, forError); }
/// <summary> /// Implements IModelErrorActivation.ActivateModelError /// </summary> protected new bool ActivateModelError(ModelError error) { RingConstraintTypeNotSpecifiedError ringTypeError; bool retVal = true; if (null != (ringTypeError = error as RingConstraintTypeNotSpecifiedError)) { Store store = Store; RingConstraint constraint = ringTypeError.RingConstraint; EditorUtility.ActivatePropertyEditor( (store as IORMToolServices).ServiceProvider, DomainTypeDescriptor.CreatePropertyDescriptor(constraint, RingConstraint.RingTypeDomainPropertyId), true); } else { retVal = base.ActivateModelError(error); } return retVal; }
/// <summary> /// Implements <see cref="IProxyDisplayProvider.ElementDisplayedAs"/> /// </summary> protected object ElementDisplayedAs(ModelElement element, ModelError forError) { Role role; FactType factType; //((Role)ModelElement).FactType == ((FactType)element).ImpliedByObjectification.NestedFactType if (null != (role = element as Role)) { return ((FactTypeShape)ParentShape).GetDiagramItem(role); } else if (null != (factType = element as FactType)) { Objectification objectification; if (null != (objectification = factType.ImpliedByObjectification) && null != (role = (Role)ModelElement) && role.FactType == objectification.NestedFactType) { return ((FactTypeShape)ParentShape).GetDiagramItem(role); } } return null; }
/// <summary> /// Implements IModelErrorActivation.ActivateModelError /// </summary> protected bool ActivateModelError(ModelError error) { bool retVal = true; ConstraintDuplicateNameError duplicateName; if (error is TooFewRoleSequencesError) { ActivateNewRoleSequenceAction(null); } else if (null != (duplicateName = error as ConstraintDuplicateNameError)) { ActivateNameProperty(ModelElement); } else { retVal = false; } return retVal; }
bool IModelErrorActivation.ActivateModelError(ModelError error) { return ActivateModelError(error); }
/// <summary> /// Implements <see cref="IModelErrorActivation.ActivateModelError"/> for /// the <see cref="FrequencyConstraintExactlyOneError"/> /// </summary> protected new bool ActivateModelError(ModelError error) { FrequencyConstraintExactlyOneError exactlyOneError; bool retVal = false; if (null != (exactlyOneError = error as FrequencyConstraintExactlyOneError)) { retVal = ((FrequencyConstraint)AssociatedConstraint).ConvertToUniquenessConstraint(); } return retVal ? true : base.ActivateModelError(error); }
/// <summary> /// Attempt to activate the specified <paramref name="error"/> /// </summary> /// <param name="error">A <see cref="ModelError"/> to activate</param> /// <returns>true if the error is recognized and successfully activated</returns> public bool ActivateModelError(ModelError error) { bool retVal = false; if (error is ObjectifiedInstanceRequiredError || error is TooFewFactTypeRoleInstancesError || error is TooFewEntityTypeRoleInstancesError || error is ObjectifyingInstanceRequiredError) { Show(); retVal = myEditor.ActivateModelError(error); } return retVal; }
public void ConstructorWithStringArgument() { // Act ModelError modelError = new ModelError("some message"); // Assert Assert.Equal("some message", modelError.ErrorMessage); Assert.Null(modelError.Exception); }