public void GetResult_WhenCalledAfterInstantiationAndPropertyDoesNotHaveAtrribute_ReturnsEmptyMaybe() { // ARRANGE Type testType = typeof(TestObject); PropertyInfo property = testType.GetProperty("Name1"); // ACT Maybe<NameAttribute> actual = new PropertyNameAttributeFinder(property).GetResult(); // ASSERT Assert.IsNull(actual.FirstOrDefault()); }
public void GetResult_WhenCalledAfterInstantiationAndPropertyDoesHaveAtrribute_ReturnsMaybePopulatedWithInstanceOfAttribute() { // ARRANGE Type testType = typeof(TestObject); PropertyInfo property = testType.GetProperty("Name2"); // ACT Maybe<NameAttribute> actual = new PropertyNameAttributeFinder(property).GetResult(); // ASSERT Assert.IsNotNull(actual); Assert.IsInstanceOfType(actual.FirstOrDefault(), typeof(NameAttribute)); }