public void GetEnumerator_WhenTheStructHasInstanceProperties_TheyAreReturned() { var propertyIterator = new GetInstancePropertyIterator<GetPropertyTestStruct>(); string[] propertyNames = propertyIterator.Select(p => p.Name).OrderBy(p => p).ToArray(); var expectedNames = new[] {"PropInt", "PropString", "PropAuto"}.OrderBy(p => p).ToArray(); Assert.Equal(expectedNames, propertyNames); }
public void GetEnumerator_WhenStructPropertyIsReturned_ItsInfoIsCorrect(string propertyName, Type propertyType) { var propertyIterator = new GetInstancePropertyIterator<GetPropertyTestStruct>(); Type propertyReturnType = propertyIterator.First(p => p.Name.Equals(propertyName)).PropertyType; Assert.Equal(propertyType, propertyReturnType); }
public void GetEnumerator_WhenTheClassHasInstanceProperties_TheyAreReturned() { var propertyIterator = new GetInstancePropertyIterator<GetPropertyTest>(); string[] propertyNames = propertyIterator.Select(p => p.Name).OrderBy(p => p).ToArray(); var expectedNames = new[] { "PropInt", "PropDouble", "PropByte", "PropShort", "PropString", "PropLong", "PropDecimal", "PropFloat", "PropAuto" } .OrderBy(p => p).ToArray(); Assert.Equal(expectedNames.OrderBy(p => p), propertyNames.OrderBy(p => p)); }