public void PropertyMethodsWithPropertyAttributeAreOptional() { Assert.That(DuckOptionalAttribute.IsOptional(GetMethod("get_OptionalProperty")), Is.True); Assert.That(DuckOptionalAttribute.IsOptional(GetMethod("set_OptionalProperty")), Is.True); Assert.That(DuckOptionalAttribute.IsOptional(GetMethod("get_OptionalGetOnlyProperty")), Is.True); Assert.That(DuckOptionalAttribute.IsOptional(GetMethod("set_OptionalSetOnlyProperty")), Is.True); }
public void PropertySetMethodWithAttributeIsOptionalWhileGetIsNot() { Assert.That(DuckOptionalAttribute.IsOptional(GetMethod("get_SetOptionalProperty")), Is.False); Assert.That(DuckOptionalAttribute.IsOptional(GetMethod("set_SetOptionalProperty")), Is.True); }
public void MethodWithoutIsNotOptional() { Assert.That(DuckOptionalAttribute.IsOptional(GetMethod("Method")), Is.False); }
public void MethodWithAttributeIsOptional() { Assert.That(DuckOptionalAttribute.IsOptional(GetMethod("OptionalMethod")), Is.True); }
public override bool IsValid() { return(Type.GetMethods().All(m => DuckOptionalAttribute.IsOptional(m) || GetBestMatch(m).Bindable)); }