/// <summary> /// Adds a message block to describe the expected values. /// </summary> /// <param name="expectedValues"> /// The expected values. /// </param> /// <param name="index"> /// The index to highlight. /// </param> /// <returns> /// The created MessageBlock. /// </returns> public MessageBlock ExpectedValues <T>(T expectedValues, long index = 0) { this.expectedNamingLogic.SetPlural(); this.expectedNamingLogic.EntityType = null; this.expectedLabel = GenericLabelBlock.BuildExpectedBlock(this.expectedNamingLogic); this.expectedBlock = MessageBlock.Build(this, expectedValues, this.expectedLabel, index, true); return(this.expectedBlock); }
/// <summary> /// Adds a block describing the checked object. /// </summary> /// <param name="test"> /// The tested object/value. /// </param> /// <param name="index"> /// The interesting index (for enumerable types). /// </param> /// <returns> /// A <see cref="FluentMessage"/> to continue build the message. /// </returns> public MessageBlock On <T>(T test, long index = 0) { var theType = test.GetTypeWithoutThrowingException(); this.checkedBlock = MessageBlock.Build(this, test, this.checkedLabel, index); this.For(theType); this.checkedType = theType; return(this.checkedBlock); }
/// <summary> /// Adds a message block to describe the given value (usually used as an /// alternative to the Expected block). /// </summary> /// <param name="givenValue">The given value.</param> /// <returns>The created MessageBlock.</returns> public MessageBlock WithGivenValue <T>(T givenValue) { this.expectedLabel = GenericLabelBlock.BuildGivenBlock(this.expectedNamingLogic); this.expectedBlock = MessageBlock.Build(this, givenValue, this.expectedLabel); return(this.expectedBlock); }
/// <summary> /// Adds a message block to describe the expected result. /// </summary> /// <param name="expected">The expected value.</param> /// <returns> /// The created MessageBlock. /// </returns> public MessageBlock ReferenceValues <T>(T expected) { this.expectedBlock = MessageBlock.Build(this, expected, this.expectedLabel); return(this.expectedBlock); }
/// <summary> /// Adds a message block to describe the expected result. /// </summary> /// <param name="expected">The expected value.</param> /// <param name="index"></param> /// <returns> /// The created MessageBlock. /// </returns> public MessageBlock Expected <T>(T expected, long index = 0) { this.expectedBlock = MessageBlock.Build(this, expected, this.expectedLabel, index); this.For(expected.GetTypeWithoutThrowingException()); return(this.expectedBlock); }