コード例 #1
0
            /// <summary>
            /// Sets the value of the specified property to the specified value
            /// </summary>
            /// <param name="user">The object instance to set the property value on</param>
            /// <param name="propertyName">The name of the property</param>
            /// <param name="propertyValue">The value of the property</param>
            private static void SetPropertyValue(UserServiceUser user, string propertyName, string propertyValue)
            {
                var property = user.GetType().GetProperty(propertyName);

                if (property.PropertyType != typeof(string))
                {
                    throw new ArgumentException("Property isn't a string");
                }

                if (!property.CanWrite)
                {
                    throw new ArgumentException("The value of the property can't be set");
                }

                property.SetValue(user, propertyValue);
            }
コード例 #2
0
 /// <summary>
 /// Creates a new ValidationShouldSucceed instance
 /// </summary>
 /// <param name="fixture">The test fixture to use</param>
 public ValidationShouldSucceed(UserAddValidatorFixture fixture)
 {
     _Fixture  = fixture;
     _TestUser = fixture.CreateValidUser();
 }