Specifies an explicit way to set a value to the tested accessors.
Namespace:
MbUnit.Framework.ContractVerifiersAssembly: MbUnit (in MbUnit.dll) Version: 3.3.0.0 (3.3.610.0)
Syntax
Remarks
Identify the tested accessors by using one of the following methods:
- Explicitly invoke the getter and the setter. : Specify how to invoke to getter and the setter by providing appropriate delegates to the Getter and Setter contract properties. The PropertyName contract property must be left unitialized (null).
- Specify the name of a property. : Set the name of the tested property by feeding the PropertyName contract property with a valid name. The explicit Getter and Setter contract properties must then be left uninitialized (null).
Examples
The following example shows how to specify explicitely a getter and a setter.
CopyC#
public class Foo { public string Name { get; set; } } [TestFixture] public class FooTest { [VerifyContract] public readonly IContract NameAccessorTests = new AccessorContract<Foo, string> { Setter = (target, value) => target.Name = value, Getter = (target) => target.Name, ValidValues = { "Value1", "Value2" }, }; }
