/// <summary> /// Initializes a new instance of the <see cref="ModelErrorDetailsTestBuilder"/> class. /// </summary> /// <param name="testContext"><see cref="ActionTestContext"/> containing data about the currently executed assertion chain.</param> /// <param name="modelErrorTestBuilder">Test builder of <see cref="IAndModelErrorTestBuilder"/> type.</param> /// <param name="errorKey">Key in <see cref="ModelStateDictionary"/> corresponding to this particular error.</param> /// <param name="aggregatedErrors">All errors found in <see cref="ModelStateDictionary"/> for given error key.</param> public ModelErrorDetailsTestBuilder( ActionTestContext testContext, IAndModelErrorTestBuilder modelErrorTestBuilder, string errorKey, IEnumerable <ModelError> aggregatedErrors) : base(testContext, errorKey, aggregatedErrors) => this.modelErrorTestBuilder = modelErrorTestBuilder;
/// <summary> /// Initializes a new instance of the <see cref="ModelErrorDetailsTestBuilder"/> class. /// </summary> /// <param name="testContext"><see cref="ActionTestContext"/> containing data about the currently executed assertion chain.</param> /// <param name="modelErrorTestBuilder">Test builder of <see cref="IAndModelErrorTestBuilder"/> type.</param> /// <param name="errorKey">Key in <see cref="ModelStateDictionary"/> corresponding to this particular error.</param> /// <param name="aggregatedErrors">All errors found in <see cref="ModelStateDictionary"/> for given error key.</param> public ModelErrorDetailsTestBuilder( ActionTestContext testContext, IAndModelErrorTestBuilder modelErrorTestBuilder, string errorKey, IEnumerable<ModelError> aggregatedErrors) : base(testContext, errorKey, aggregatedErrors) { this.modelErrorTestBuilder = modelErrorTestBuilder; }
/// <summary> /// Initializes a new instance of the <see cref="ModelErrorDetailsTestBuilder{TModel}"/> class. /// </summary> /// <param name="testContext"><see cref="ActionTestContext"/> containing data about the currently executed assertion chain.</param> /// <param name="modelErrorTestBuilder">Test builder of <see cref="IAndModelErrorTestBuilder{TModel}"/> type.</param> /// <param name="errorKey">Key in <see cref="ModelStateDictionary"/> corresponding to this particular error.</param> /// <param name="aggregatedErrors">All errors found in <see cref="ModelStateDictionary"/> for given error key.</param> public ModelErrorDetailsTestBuilder( ActionTestContext testContext, IAndModelErrorTestBuilder <TModel> modelErrorTestBuilder, string errorKey, IEnumerable <ModelError> aggregatedErrors) : base(testContext) { this.modelErrorTestBuilder = modelErrorTestBuilder; this.currentErrorKey = errorKey; this.aggregatedErrors = aggregatedErrors.Select(me => me.ErrorMessage); }
/// <summary> /// Initializes a new instance of the <see cref="ModelErrorDetailsTestBuilder{TModel}" /> class. /// </summary> /// <param name="controller">Controller on which the action will be tested.</param> /// <param name="actionName">Name of the tested action.</param> /// <param name="caughtException">Caught exception during the action execution.</param> /// <param name="model">Model returned from action result.</param> /// <param name="modelErrorTestBuilder">Original model error test builder.</param> /// <param name="errorKey">Key in ModelStateDictionary corresponding to this particular error.</param> /// <param name="aggregatedErrors">All errors found in ModelStateDictionary for given error key.</param> public ModelErrorDetailsTestBuilder( ApiController controller, string actionName, Exception caughtException, TModel model, IAndModelErrorTestBuilder <TModel> modelErrorTestBuilder, string errorKey, IEnumerable <ModelError> aggregatedErrors) : base(controller, actionName, caughtException, model) { this.modelErrorTestBuilder = modelErrorTestBuilder; this.currentErrorKey = errorKey; this.aggregatedErrors = aggregatedErrors.Select(me => me.ErrorMessage); }