/// <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 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); }
/// <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(object test, long index = 0) { this.checkedBlock = new MessageBlock(this, test, this.checkedLabel, index); if (this.referenceType == null) { this.referenceType = test.GetTypeWithoutThrowingException(); } this.checkedType = test.GetTypeWithoutThrowingException(); return(this.checkedBlock); }
internal static MessageBlock Build <T>(FluentMessage message, T value, GenericLabelBlock block, long index = 0, bool forceArray = false) { var result = new MessageBlock(message, block); if (value.IsAnEnumeration(forceArray)) { result.value = new EnumerationBlock <IEnumerable>(value as IEnumerable, index); } else { result.value = new ValueBlock <T>(value); } return(result); }
/// <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) { this.expectedValuesBlock = new MessageBlock(this, expectedValues, ExpectedAdjective); this.expectedValuesBlock.Label("The expected value(s):"); return(this.expectedValuesBlock); }
/// <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 Expected(object expected) { this.expectedBlock = new MessageBlock(this, expected, this.expectedLabel); this.referenceType = expected.GetTypeWithoutThrowingException(); return this.expectedBlock; }
/// <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(object givenValue) { this.expectedLabel = GenericLabelBlock.BuildGivenBlock(this.checkedNamer); this.expectedBlock = new MessageBlock(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(object expected) { this.expectedBlock = new MessageBlock(this, expected, this.expectedLabel); return(this.expectedBlock); }
/// <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) { this.expectedValuesBlock = new MessageBlock(this, expectedValues, ExpectedAdjective); this.expectedValuesBlock.Label("The expected value(s):"); return this.expectedValuesBlock; }
/// <summary> /// Adds a block describing the checked objet. /// </summary> /// <param name="test">The tested object/value.</param> /// <returns>A <see cref="FluentMessage"/> to continue build the message.</returns> public MessageBlock On(object test) { this.checkedBlock = new MessageBlock(this, test, TestedAdjective); 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(object givenValue) { this.expectedLabel = GenericLabelBlock.BuildGivenBlock(this.checkedNamer); this.expectedBlock = new MessageBlock(this, givenValue, this.expectedLabel); return this.expectedBlock; }
/// <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; }
/// <summary> /// Adds a message block to describe the expected type. /// </summary> /// <param name="expectedType">The expected type.</param> /// <returns>The created MessageBlock.</returns> public MessageBlock ExpectedType(Type expectedType) { this.expectedBlock = new MessageBlock(this, expectedType, this.expectedLabel); this.referenceType = null; 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(object expected) { this.expectedBlock = new MessageBlock(this, expected, this.expectedLabel); return this.expectedBlock; }
/// <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(object givenValue) { this.givenValueBlock = new MessageBlock(this, givenValue, GivenAdjective); return(this.givenValueBlock); }
/// <summary> /// Adds a message block to describe the expected type. /// </summary> /// <param name="expectedType">The expected type.</param> /// <returns>The created MessageBlock.</returns> public MessageBlock ExpectedType(Type expectedType) { this.expectedBlock = new MessageBlock(this, expectedType, ExpectedAdjective); 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); }
/// <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 Expected(object expected) { this.expectedBlock = new MessageBlock(this, expected, ExpectedAdjective); 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 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(object givenValue) { this.givenValueBlock = new MessageBlock(this, givenValue, GivenAdjective); return this.givenValueBlock; }
/// <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 Expected(object expected) { this.expectedBlock = new MessageBlock(this, expected, this.expectedLabel); this.referenceType = expected.GetTypeWithoutThrowingException(); return(this.expectedBlock); }
/// <summary> /// Adds a block describing the checked objet. /// </summary> /// <param name="test">The tested object/value.</param> /// <returns>A <see cref="FluentMessage"/> to continue build the message.</returns> public MessageBlock On(object test) { this.checkedBlock = new MessageBlock(this, test, TestedAdjective); return(this.checkedBlock); }
/// <summary> /// Adds a message block to describe the expected type. /// </summary> /// <param name="expectedType">The expected type.</param> /// <returns>The created MessageBlock.</returns> public MessageBlock ExpectedType(Type expectedType) { this.expectedBlock = new MessageBlock(this, expectedType, this.expectedLabel); this.referenceType = null; 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 Expected(object expected) { this.expectedBlock = new MessageBlock(this, expected, ExpectedAdjective); return(this.expectedBlock); }
/// <summary> /// Adds a message block to describe the expected type. /// </summary> /// <param name="expectedType">The expected type.</param> /// <returns>The created MessageBlock.</returns> public MessageBlock ExpectedType(Type expectedType) { this.expectedBlock = new MessageBlock(this, expectedType, ExpectedAdjective); return(this.expectedBlock); }
/// <summary> /// Adds a block describing the checked objet. /// </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(object test, int index=0) { this.checkedBlock = new MessageBlock(this, test, this.checkedLabel, index); if (this.referenceType == null) { this.referenceType = test.GetTypeWithoutThrowingException(); } this.checkedType = test.GetTypeWithoutThrowingException(); return this.checkedBlock; }