Example #1
0
		/// <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);
		}
Example #2
0
		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);
		}
Example #3
0
		/// <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());
		}