Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 public void PropertySetMethodWithAttributeIsOptionalWhileGetIsNot()
 {
     Assert.That(DuckOptionalAttribute.IsOptional(GetMethod("get_SetOptionalProperty")), Is.False);
     Assert.That(DuckOptionalAttribute.IsOptional(GetMethod("set_SetOptionalProperty")), Is.True);
 }
Esempio n. 3
0
 public void MethodWithoutIsNotOptional()
 {
     Assert.That(DuckOptionalAttribute.IsOptional(GetMethod("Method")), Is.False);
 }
Esempio n. 4
0
 public void MethodWithAttributeIsOptional()
 {
     Assert.That(DuckOptionalAttribute.IsOptional(GetMethod("OptionalMethod")), Is.True);
 }
Esempio n. 5
0
 public override bool IsValid()
 {
     return(Type.GetMethods().All(m => DuckOptionalAttribute.IsOptional(m) || GetBestMatch(m).Bindable));
 }