Exemple #1
0
        public override int GetHashCode()
        {
            var hash = 0;

            if (BackgroundColor.HasValue)
            {
                var colorRgb = BackgroundColor.Value.ToArgb();
                hash ^= colorRgb.GetHashCode();
            }
            if (ForegroundColor.HasValue)
            {
                var colorRgb = ForegroundColor.Value.ToArgb();
                hash ^= colorRgb.GetHashCode();
            }
            if (Font != null)
            {
                var fontid = Font.ToString();
                hash ^= fontid.GetHashCode();
            }
            if (Alignment.HasValue)
            {
                var aligment = Alignment.Value.ToString();
                hash ^= aligment.GetHashCode();
            }

            if (VerticalAlignment.HasValue)
            {
                var aligment = VerticalAlignment.Value.ToString();
                hash ^= aligment.GetHashCode();
            }

            return(hash ^ Indent ^ IsDate.GetHashCode() ^ WrapText.GetHashCode());
        }
Exemple #2
0
        public void TestIsDate()
        {
            SingleRule       rule   = new IsDate("dd/M/yyyy");
            ValidationResult result = rule.Validate("18/1/2017");

            Assert.IsTrue(result.IsValid);
        }
Exemple #3
0
        public void IsDate_HandlesType_ReturnsIsDateType()
        {
            var decisionType = enDecisionType.IsDate;
            //------------Setup for test--------------------------
            var isDate = new IsDate();

            //------------Execute Test---------------------------
            //------------Assert Results-------------------------
            Assert.AreEqual(decisionType, isDate.HandlesType());
        }
Exemple #4
0
        public void IsDate_Invoke_IsDate_ReturnsTrue()
        {
            //------------Setup for test--------------------------
            var notStartsWith = new IsDate();
            var cols          = new string[2];

            cols[0] = "01/12/2000";
            //------------Execute Test---------------------------
            var result = notStartsWith.Invoke(cols);

            //------------Assert Results-------------------------
            Assert.IsTrue(result);
        }
Exemple #5
0
        public void GivenSomeString_IsDate_Invoke_ReturnsFalse()
        {
            //------------Setup for test--------------------------
            var isDate = new IsDate();
            var cols   = new string[2];

            cols[0] = "Yersteday";
            //------------Execute Test---------------------------
            var result = isDate.Invoke(cols);

            //------------Assert Results-------------------------
            Assert.IsFalse(result);
        }
 public override string ToString()
 {
     return("{\"isProperty\":\"true\",\"isDate\":\"" + IsDate.ToString() + "\",\"propertyName\":\"" + PropertyName + "\"}");
 }