コード例 #1
0
ファイル: ThisCompareAction.cs プロジェクト: ITAGroup/SpecAid
        public CompareColumnResult GoGoCompareColumnAction(object target, string tableValue)
        {
            if (tableValue == ConstantStrings.IgnoreCell)
                return new CompareColumnResult();

            var thisObject = new ThisObject(target);

            var compareResult = new CompareColumnResult();
            var expectedValue = Translator.Translate(_info, tableValue);
            var actualValue = thisObject == null ? null : _info.GetValue(thisObject, null);

            compareResult.ExpectedPrint = ToStringHelper.SafeToString(expectedValue);
            compareResult.ActualPrint = ToStringHelper.SafeToString(actualValue);

            // Refactor to be blah = blah 
            try
            {
                Assert.AreEqual(TypeConversion.SafeConvert(expectedValue, actualValue), actualValue);
            }
            catch (Exception)
            {
                compareResult.IsError = true;
                compareResult.ErrorMessage = "Error on Property " + _info.Name + ", Expected '" + compareResult.ExpectedPrint + "', Actual '" + compareResult.ActualPrint + "'";
            }

            return compareResult;
        }
コード例 #2
0
        public CompareColumnResult GoGoCompareColumnAction(object target, string tableValue)
        {
            if (tableValue == ConstantStrings.IgnoreCell)
            {
                return(new CompareColumnResult());
            }

            var thisObject = new ThisObject(target);

            var compareResult = new CompareColumnResult();
            var expectedValue = Translator.Translate(_info, tableValue);
            var actualValue   = thisObject == null ? null : _info.GetValue(thisObject, null);

            compareResult.ExpectedPrint = ToStringHelper.SafeToString(expectedValue);
            compareResult.ActualPrint   = ToStringHelper.SafeToString(actualValue);

            // Refactor to be blah = blah
            try
            {
                Assert.AreEqual(TypeConversion.SafeConvert(expectedValue, actualValue), actualValue);
            }
            catch (Exception)
            {
                compareResult.IsError      = true;
                compareResult.ErrorMessage = "Error on Property " + _info.Name + ", Expected '" + compareResult.ExpectedPrint + "', Actual '" + compareResult.ActualPrint + "'";
            }

            return(compareResult);
        }
コード例 #3
0
ファイル: ThisCompareAction.cs プロジェクト: ITAGroup/SpecAid
        public CompareColumnResult GoGoCompareColumnAction(object target)
        {
            var thisObject = new ThisObject(target);

            // While the record is missing... this column isn't an error as it is n/a
            var compareResult = new CompareColumnResult();
            var actualValue = thisObject == null ? null : _info.GetValue(thisObject, null);
            compareResult.ActualPrint = ToStringHelper.SafeToString(actualValue);
            compareResult.IsError = false;
            return compareResult;
        }
コード例 #4
0
        public CompareColumnResult GoGoCompareColumnAction(object target)
        {
            var thisObject = new ThisObject(target);

            // While the record is missing... this column isn't an error as it is n/a
            var compareResult = new CompareColumnResult();
            var actualValue   = thisObject == null ? null : _info.GetValue(thisObject, null);

            compareResult.ActualPrint = ToStringHelper.SafeToString(actualValue);
            compareResult.IsError     = false;
            return(compareResult);
        }