public SequentialCallContext(CallWriter callWriter, StringBuilderOutputWriter.Factory outputWriterFactory) { Guard.AgainstNull(callWriter, nameof(callWriter)); this.callWriter = callWriter; this.outputWriterFactory = outputWriterFactory; this.fakeManagers = new HashSet <FakeManager>(); this.assertedCalls = new List <AssertedCall>(); this.currentSequenceNumber = -1; }
public FakeAsserter(IEnumerable <ICompletedFakeObjectCall> calls, CallWriter callWriter, StringBuilderOutputWriter.Factory outputWriterFactory) { Guard.AgainstNull(calls, nameof(calls)); Guard.AgainstNull(callWriter, nameof(callWriter)); this.calls = calls; this.callWriter = callWriter; this.outputWriterFactory = outputWriterFactory; }
/// <summary> /// Initializes a new instance of the <see cref="ExpressionCallMatcher" /> class. /// </summary> /// <param name="parsedExpression">The parsed call specification.</param> /// <param name="constraintFactory">The constraint factory.</param> /// <param name="methodInfoManager">The method info manager to use.</param> /// <param name="outputWriterFactory">The output writer factory to use.</param> public ExpressionCallMatcher(ParsedCallExpression parsedExpression, ExpressionArgumentConstraintFactory constraintFactory, MethodInfoManager methodInfoManager, StringBuilderOutputWriter.Factory outputWriterFactory) { this.methodInfoManager = methodInfoManager; this.outputWriterFactory = outputWriterFactory; this.Method = parsedExpression.CalledMethod; this.argumentConstraints = GetArgumentConstraints(parsedExpression.ArgumentsExpressions, constraintFactory).ToArray(); this.argumentsPredicate = this.ArgumentsMatchesArgumentConstraints; }
public ExpressionCallMatcherTests() { this.constraintFactory = A.Fake <ExpressionArgumentConstraintFactory>(); var validator = A.Fake <IArgumentConstraint>(); A.CallTo(() => validator.IsValid(A <object> ._)).Returns(true); A.CallTo(() => this.constraintFactory.GetArgumentConstraint(A <ParsedArgumentExpression> ._)).Returns(validator); this.methodInfoManager = A.Fake <MethodInfoManager>(); this.parser = new CallExpressionParser(); this.outputWriterFactory = () => new StringBuilderOutputWriter( new ArgumentValueFormatter(Enumerable.Empty <IArgumentValueFormatter>())); }
public ArgumentValueFormatter(IEnumerable <IArgumentValueFormatter> typeFormatters, StringBuilderOutputWriter.Factory outputWriterFactory) { this.cachedFormatters = new ConcurrentDictionary <Type, IArgumentValueFormatter>(); this.typeFormatters = typeFormatters.Concat( new IArgumentValueFormatter[] { new DefaultStringFormatter(), new DefaultEnumerableValueFormatter(outputWriterFactory), new DefaultFormatter() }); }
public DefaultEnumerableValueFormatter(StringBuilderOutputWriter.Factory outputWriterFactory) { this.outputWriterFactory = outputWriterFactory; }
public FakeAsserterTests() { this.calls = new List <ICompletedFakeObjectCall>(); this.callWriter = A.Fake <CallWriter>(); this.outputWriterFactory = A.Fake <StringBuilderOutputWriter.Factory>(); }