コード例 #1
0
        public void RequiredEnumAttribute_Validate_Valid()
        {
            var objectWithEnum = new ObjectWithEnum()
            {
                Enum = FilledEnum.Item1
            };

            Assert.Empty(ValidateModel(objectWithEnum));
        }
コード例 #2
0
        public void RequiredEnumAttribute_Validate_Invalid()
        {
            int invalidEnumIndex = -1;
            var enumValue        = (FilledEnum)invalidEnumIndex;

            var objectWithEnum = new ObjectWithEnum()
            {
                Enum = enumValue
            };

            Assert.Single(ValidateModel(objectWithEnum));
        }