Exemplo n.º 1
0
			/// <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;
			}
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
			/// <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;
			}
Exemplo n.º 7
0
		/// <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));
		}
Exemplo n.º 8
0
		/// <summary>
		/// Notes the missing property.
		/// </summary>
		/// <param name="itemValidation">The item validation.</param>
		internal void NoteMissingProperty(ItemValidation itemValidation)
		{
			this.PropertyResults.Add(new PropertyResult(itemValidation));
		}
Exemplo n.º 9
0
        public void TestToStringWithNullValueReturnsRelevantItemData()
        {
            var item = new ItemValidation(" Field ", " equals ", null);

            var result = item.ToString();

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

            var result = item.ToString();

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