public void HaveRequiredAttribute() { var rim = new RimWithTire(); var result = rim .GetType() .GetProperty("CentralHoleSize") .GetCustomAttributes(false) .Where(x => x.GetType() == typeof(System.ComponentModel.DataAnnotations.RequiredAttribute)) .Any(); Assert.True(result); }
public void HaveStringLengthAttributeAttribute() { var bm = new RimWithTire(); var result = bm .GetType() .GetProperty("WeightIndex") .GetCustomAttributes(false) .Where(x => x.GetType() == typeof(System.ComponentModel.DataAnnotations.StringLengthAttribute)) .Any(); Assert.True(result); }
public void HaveRangeAttribute() { var rim = new RimWithTire(); var result = rim .GetType() .GetProperty("SpaceBetweenBolts") .GetCustomAttributes(false) .Where(x => x.GetType() == typeof(System.ComponentModel.DataAnnotations.RangeAttribute)) .Any(); Assert.True(result); }