/// <summary> /// Sets the property. /// </summary> /// <param name="propertyName">Name of the property.</param> /// <returns></returns> protected internal IValueSyntaxBuilder SetProperty(string propertyName) { Matcher methodMatcher = new DescriptionOverride(propertyName + " = ", new MethodNameMatcher(Constants.SET + propertyName, MockObject.MockedTypes.PrimaryType)); EnsureMatchingMethodExistsOnMock(methodMatcher, "a setter for property " + propertyName); BuildableExpectation.MethodMatcher = methodMatcher; return new PropertyValueBuilder(this); }
protected IValueSyntaxBuilder SetIndexer(params object[] expectedArguments) { Matcher methodMatcher = new DescriptionOverride(String.Empty, new MethodNameMatcher(Constants.SET_ITEM, MockObject.MockedTypes.PrimaryType)); EnsureMatchingMethodExistsOnMock(methodMatcher, "an indexed setter"); BuildableExpectation.DescribeAsIndexer(); BuildableExpectation.MethodMatcher = methodMatcher; return new IndexSetterBuilder(BuildableExpectation, this).WithParameters(expectedArguments); }
/// <summary> /// Gets the property. /// </summary> /// <param name="propertyName">Name of the property.</param> /// <returns></returns> protected void GetProperty(string propertyName) { Matcher methodMatcher = new DescriptionOverride(propertyName, new MethodNameMatcher(Constants.GET + propertyName, MockObject.MockedTypes.PrimaryType)); EnsureMatchingMethodExistsOnMock(methodMatcher, "a getter for property " + propertyName); BuildableExpectation.MethodMatcher = methodMatcher; BuildableExpectation.ArgumentsMatcher = new DescriptionOverride(String.Empty, new ArgumentsMatcher()); }