public static string DiagName(this PendingSpecificationInfo pendingSpecification, DiagContextInternal ctx) { string innerInfo = pendingSpecification.Handle( spec => $"SPEC|{spec.DiagName()}", call => $"CALL|{call.DiagName(ctx)}"); return($"<{innerInfo}>"); }
public override void Context() { base.Context(); _lastCallSpecification = mock <ICallSpecification>(); _pendingSpecification.stub(x => x.HasPendingCallSpecInfo()).Return(true); var specificationInfo = PendingSpecificationInfo.FromCallSpecification(_lastCallSpecification); _pendingSpecification.stub(x => x.UseCallSpecInfo()).Return(specificationInfo); }
public override void Context() { base.Context(); _callSpecUpdatedForAnyArgs = mock <ICallSpecification>(); _lastCallSpecification = mock <ICallSpecification>(); var specificationInfo = PendingSpecificationInfo.FromCallSpecification(_lastCallSpecification); _pendingSpecification.stub(x => x.HasPendingCallSpecInfo()).Return(true); _pendingSpecification.stub(x => x.UseCallSpecInfo()).Return(specificationInfo); _lastCallSpecification.stub(x => x.CreateCopyThatMatchesAnyArguments()).Return(_callSpecUpdatedForAnyArgs); }
public void Set_pending_specification_should_be_returned_scenario2() { var callSpec = Substitute.For <ICallSpecification>(); var specificationInfo = PendingSpecificationInfo.FromCallSpecification(callSpec); SubstitutionContext.Current.PendingSpecificationInfo = specificationInfo; var result = SubstitutionContext.Current.PendingSpecificationInfo; var encapsulatedObject = result.Handle <object>(x => x, x => x); Assert.That(encapsulatedObject, Is.SameAs(callSpec)); }
public ConfiguredCall LastCallShouldReturn(IReturn returnValue, MatchArgs matchArgs, PendingSpecificationInfo pendingSpecInfo) { Trace($"LastCallShouldReturn(value: {returnValue.DiagName(_ctx)}, " + $"matchArgs: {matchArgs.DiagName()}, pendingSpecInfo: {pendingSpecInfo.DiagName(_ctx)})"); Log($"[Configure last call] " + $"CallSpecification: {pendingSpecInfo.DiagName(_ctx)} " + $"Value: {returnValue.DiagName(_ctx)} " + $"Match: {matchArgs.DiagName()} "); return(_impl.LastCallShouldReturn(returnValue, matchArgs, pendingSpecInfo)); }
public override void Context() { base.Context(); _call = mock <ICall>(); var specificationInfo = PendingSpecificationInfo.FromLastCall(_call); _pendingSpecification.stub(x => x.HasPendingCallSpecInfo()).Return(true); _pendingSpecification.stub(x => x.UseCallSpecInfo()).Return(specificationInfo); _callSpecification = mock <ICallSpecification>(); _callSpecificationFactory.stub(x => x.CreateFrom(_call, _argMatchStrategy)).Return(_callSpecification); }
public void Pending_specification_getter_should_not_remove_value() { var call = Substitute.For <ICall>(); var specificationInfo = PendingSpecificationInfo.FromLastCall(call); SubstitutionContext.Current.PendingSpecificationInfo = specificationInfo; var result = SubstitutionContext.Current.PendingSpecificationInfo; result = SubstitutionContext.Current.PendingSpecificationInfo; result = SubstitutionContext.Current.PendingSpecificationInfo; var encapsulatedObject = result.Handle <object>(x => x, x => x); Assert.That(encapsulatedObject, Is.SameAs(call)); }
public ConfiguredCall LastCallShouldReturn(IReturn returnValue, MatchArgs matchArgs, PendingSpecificationInfo pendingSpecInfo) => throw new NotImplementedException();
public override void Context() { base.Context(); _specInfo = PendingSpecificationInfo.FromLastCall(mock <ICall>()); }