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)); }
/// <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); }