/// <summary> /// Sets up the Get Indexer expectations /// </summary> /// <param name="expectedArguments"></param> /// <remarks>No need to pass the method name because it is always 'get_Item'.</remarks> private void GetIndexer(object[] expectedArguments) { Matcher methodMatcher = new DescriptionOverride(string.Empty, new MethodNameMatcher(Constants.GET_ITEM, MockObject.MockedTypes.PrimaryType)); EnsureMatchingMethodExistsOnMock(methodMatcher, "an indexed getter"); BuildableExpectation.DescribeAsIndexer(); BuildableExpectation.MethodMatcher = methodMatcher; BuildableExpectation.ArgumentsMatcher = new IndexGetterArgumentsMatcher(ArgumentMatchers(expectedArguments)); //*DevNote: Use the section below when Get[] is refactored //name = ((MethodCallExpression) expression.Body).Method.Name.Replace(GET, string.Empty); //IMatchSyntax matchSyntax = GetProperty(name); ////check for args //if (expectedArguments.Length > 0) //{ // //properties have args when used like GetProperty(m=>m.prop[1]) // base.With(expectedArguments); //} }
/// <summary> /// Initializes a new instance of the <see cref="IndexSetterBuilder"/> class. /// </summary> /// <param name="expectation">The expectation.</param> /// <param name="builder">The builder.</param> public IndexSetterBuilder(BuildableExpectation expectation, ExpectationBuilder builder) { _expectation = expectation; _builder = builder; }
private ExpectationBuilder(string description, Matcher requiredCountMatcher, Matcher matchingCountMatcher) { BuildableExpectation = new BuildableExpectation(description, requiredCountMatcher, matchingCountMatcher); }