/// <summary> /// Initializes a new instance of the <see cref="FluentMessage"/> class. /// </summary> /// <param name="message"> /// The main message. /// </param> /// <remarks> /// You can use {x} as place holders for standard wordings: /// - {0}. /// </remarks> private FluentMessage(string message) { this.message = message; this.EntityDescription = null; this.checkedNamer = new EntityNamer(); this.expectedNamer = new EntityNamer(); this.checkedLabel = GenericLabelBlock.BuildCheckedBlock(this.checkedNamer); this.expectedLabel = GenericLabelBlock.BuildExpectedBlock(this.expectedNamer); }
/// <summary> /// Initializes a new instance of the <see cref="FluentMessage"/> class. /// </summary> /// <param name="message"> /// The main message. /// </param> /// <remarks> /// You can use {x} as place holders for standard wordings: /// - {0}. /// </remarks> private FluentMessage(string message) { this.message = message ?? throw new ArgumentNullException(nameof(message)); this.entity = null; this.checkedNamer = new EntityNamer(); this.expectedNamer = new EntityNamer(); this.checkedLabel = GenericLabelBlock.BuildCheckedBlock(this.checkedNamer); this.expectedLabel = GenericLabelBlock.BuildExpectedBlock(this.expectedNamer); }
/// <summary> /// Adds a message block to describe the expected values. /// </summary> /// <param name="expectedValues">The expected values.</param> /// <returns>The created MessageBlock.</returns> public MessageBlock ExpectedValues(object expectedValues) { var customNamer = new EntityNamer { EntityName = "value(s)" }; this.expectedLabel = GenericLabelBlock.BuildExpectedBlock(customNamer); this.expectedBlock = new MessageBlock(this, expectedValues, this.expectedLabel); this.referenceType = this.referenceType ?? expectedValues.GetTypeWithoutThrowingException(); return(this.expectedBlock); }