/// <summary>
			/// Initializes a new instance of the <see cref="PropertyResult" /> class.
			/// </summary>
			/// <param name="itemValidation">The item validation.</param>
			/// <param name="successful">if set to <c>true</c> [successful].</param>
			/// <param name="actualValue">The actual value.</param>
			internal PropertyResult(ItemValidation itemValidation, bool successful, string actualValue)
			{
				this.FieldExists = true;
				this.Validation = itemValidation;
				this.IsValid = successful;
				this.ActualValue = actualValue;
			}
        public void TestConstructorRawValuesWhenValuesHaveWhitespaceAreTrimmedWhenStored()
        {
            var item = new ItemValidation(" Field ", " equals ", " value ");

            Assert.AreEqual("Field", item.RawFieldName);
            Assert.AreEqual("equals", item.RawComparisonType);
            Assert.AreEqual("value", item.RawComparisonValue);
        }
        public void TestConstructorRawValuesWhenNullSetsNulls()
        {
            var item = new ItemValidation(null, null, null);

            Assert.IsNull(item.RawFieldName);
            Assert.IsNull(item.RawComparisonType);
            Assert.IsNull(item.RawComparisonValue);
            Assert.IsNull(item.FieldName);
            Assert.IsNull(item.ComparisonValue);
        }
        public void TestConstructorRawValuesWhenValuesAreSetAreStored()
        {
            var item = new ItemValidation("Field", "equals", "value");

            Assert.AreEqual("Field", item.RawFieldName);
            Assert.AreEqual("equals", item.RawComparisonType);
            Assert.AreEqual("value", item.RawComparisonValue);

            Assert.IsNull(item.FieldName);
            Assert.IsNull(item.ComparisonValue);
        }
        public void TestCompareWithValuesSetAndEqualReturnsTrue()
        {
            var item = new ItemValidation(" Field ", " equals ", " value ")
                           {
                               FieldName = "field",
                               ComparisonValue = "value",
                               Comparer = new EqualsComparer()
                           };

            var propertyData = new Mock<IPropertyData>(MockBehavior.Strict);

            var result = item.Compare(propertyData.Object, "value");

            Assert.AreEqual(true, result);

            propertyData.VerifyAll();
        }
			/// <summary>
			/// Initializes a new instance of the <see cref="PropertyResult"/> class.
			/// </summary>
			/// <param name="validation">The validation.</param>
			internal PropertyResult(ItemValidation validation)
			{
				this.Validation = validation;
				this.IsValid = false;
				this.FieldExists = false;
			}
		/// <summary>
		/// Notes the validation result.
		/// </summary>
		/// <param name="itemValidation">The item validation.</param>
		/// <param name="successful">if set to <c>true</c> the validation was successful.</param>
		/// <param name="actualValue">The actual value.</param>
		internal void NoteValidationResult(ItemValidation itemValidation, bool successful, string actualValue)
		{
			this.PropertyResults.Add(new PropertyResult(itemValidation, successful, actualValue));
		}
		/// <summary>
		/// Notes the missing property.
		/// </summary>
		/// <param name="itemValidation">The item validation.</param>
		internal void NoteMissingProperty(ItemValidation itemValidation)
		{
			this.PropertyResults.Add(new PropertyResult(itemValidation));
		}
        public void TestToStringWithNullValueReturnsRelevantItemData()
        {
            var item = new ItemValidation(" Field ", " equals ", null);

            var result = item.ToString();

            Assert.AreEqual("Field equals <NULL>", result);
        }
        public void TestToStringReturnsRelevantItemData()
        {
            var item = new ItemValidation(" Field ", " equals ", " value ");

            var result = item.ToString();

            Assert.AreEqual("Field equals value", result);
        }