예제 #1
0
        public void HexRecordLengthValidation()
        {
            Action<string> func = (record) =>
            {
                IHexRecordValidator validator = new HexRecordLengthValidator();
                validator.Validate(record);
            };

            func(":020000021000EC");
            func(":10C22000F04EF05FF06CF07DCA0050C2F086F097DF");
            func(":10C23000F04AF054BCF5204830592D02E018BB03F9");
            func(":020000020000FC");
            func(":04000000FA00000200");
            func(":00000001FF");
        }
예제 #2
0
        public void HexRecordLengthValidationException()
        {
            Action<string> func = (record) =>
            {
                IHexRecordValidator validator = new HexRecordLengthValidator();
                bool hasException = false;
                Exception expectedException = null;
                try
                {
                    validator.Validate(record);
                }
                catch (Exception ex)
                {
                    hasException = true;
                    expectedException = ex;
                }

                Assert.IsTrue(hasException);
                Assert.IsTrue(expectedException is HexRecordValidationException);

            };

            func(":0200000210000000EC");
            func(":02C22000F04EF05FF06CF07DCA0050C2F086F097DF");
        }