示例#1
0
        public void GetPropatyNamesWithAttribute()
        {
            // Arrange
            var target = new TargetClass();

            // Act
            var actual = ValidationUtility.GetPropatyNamesWithAttribute(typeof(TargetClass));

            // Assert
            var expected = new List <string> {
                "Id", "Message"
            };

            Assert.True(TestHelper.IsSameCollection(expected, (List <string>)actual));
        }
示例#2
0
        /// <summary>
        /// すべてのデータ検証対象プロパティのデータ検証を行います。
        /// </summary>
        /// <returns></returns>
        protected bool Validate()
        {
            var result     = true;
            var properties = ValidationUtility.GetPropatyNamesWithAttribute(GetType());

            foreach (var property in properties)
            {
                _dictionary.RemoveErrorByKey(property);
                if (!Validate(property))
                {
                    result = false;
                }
            }

            return(result);
        }