Пример #1
0
        public void InfoWithEventCodeThatHasValueAndValueNameIsValid()
        {
            var info = new Info();
            string valueName = "HSAS";
            string value = "SVR";
            var eventCode = new EventCode(valueName, value);
            info.EventCodes.Add(eventCode);

            var eventCodesValidator = new EventCodesValidator(info);
            Assert.True(eventCodesValidator.IsValid);
        }
Пример #2
0
        public void InfoWithEventCodeThatHasValueNullAndValueNameIsInvalid()
        {
            var info = new Info();
            string valueName = "HSAS";
            string value = null;
            var eventCode = new EventCode(valueName, value);
            info.EventCodes.Add(eventCode);

            var eventCodesValidator = new EventCodesValidator(info);
            Assert.False(eventCodesValidator.IsValid);
            Assert.Equal(typeof(EventCodeError), eventCodesValidator.Errors.ElementAt(0).GetType());
        }
Пример #3
0
        public void InfoWithEventCodeThatHasValueAndValueNameIsValid()
        {
            var    info      = new Info();
            string valueName = "HSAS";
            string value     = "SVR";
            var    eventCode = new EventCode(valueName, value);

            info.EventCodes.Add(eventCode);

            var eventCodesValidator = new EventCodesValidator(info);

            Assert.True(eventCodesValidator.IsValid);
        }
Пример #4
0
        public void InfoWithEventCodeThatHasValueNullAndValueNameIsInvalid()
        {
            var    info      = new Info();
            string valueName = "HSAS";
            string value     = null;
            var    eventCode = new EventCode(valueName, value);

            info.EventCodes.Add(eventCode);

            var eventCodesValidator = new EventCodesValidator(info);

            Assert.False(eventCodesValidator.IsValid);
            Assert.Equal(typeof(NamedValueError <EventCode>), eventCodesValidator.Errors.ElementAt(0).GetType());
        }