├── .editorconfig ├── .gitattributes ├── .gitignore ├── .hgeol ├── .repoconfig ├── .travis.yml ├── BreakingChanges.txt ├── Build ├── ExtractDocs.fsx ├── NSubstitute.nuspec ├── NSubstitute.targets └── samples.csproj ├── CHANGELOG.txt ├── Gemfile ├── Gemfile.lock ├── LICENSE.txt ├── NSubstitute.sublime-project ├── README.markdown ├── Source ├── Docs │ ├── _config.yml │ ├── _layouts │ │ ├── default.html │ │ └── post.html │ ├── _plugins │ │ ├── examplecode.rb │ │ └── requiredcode.rb │ ├── css │ │ ├── shCore.css │ │ ├── shCoreDefault.css │ │ ├── shThemeDefault.css │ │ └── style.css │ ├── downloads │ │ ├── NSubstitute-0.1.0.zip │ │ ├── NSubstitute-0.1.1.zip │ │ ├── NSubstitute-0.1.2.zip │ │ ├── NSubstitute-0.1.3.zip │ │ ├── NSubstitute-0.9.0.zip │ │ ├── NSubstitute-0.9.5.zip │ │ ├── NSubstitute-1.0.0.zip │ │ ├── NSubstitute-1.1.0.zip │ │ ├── NSubstitute-1.2.0.0.zip │ │ ├── NSubstitute-1.2.1.0.zip │ │ ├── NSubstitute-1.3.0.0.zip │ │ ├── NSubstitute-1.4.0.0.zip │ │ ├── NSubstitute-1.4.1.0.zip │ │ ├── NSubstitute-1.4.2.0.zip │ │ ├── NSubstitute-1.4.3.0.zip │ │ ├── NSubstitute-1.5.0.0.zip │ │ ├── NSubstitute-1.6.0.0.zip │ │ ├── NSubstitute-1.6.1.0.zip │ │ ├── NSubstitute-1.7.0.0.zip │ │ ├── NSubstitute-1.7.1.0.zip │ │ ├── NSubstitute-1.7.2.0.zip │ │ ├── NSubstitute.1.10.0.0.zip │ │ ├── NSubstitute.1.8.0.0.zip │ │ ├── NSubstitute.1.8.1.0.zip │ │ ├── NSubstitute.1.8.2.0.zip │ │ ├── NSubstitute.1.9.0.0.zip │ │ ├── NSubstitute.1.9.1.0.zip │ │ ├── NSubstitute.1.9.2.0.zip │ │ ├── NSubstitute.2.0.0.0.zip │ │ ├── NSubstitute.2.0.1.0.zip │ │ ├── NSubstitute.2.0.2.0.zip │ │ └── NSubstitute.2.0.3.0.zip │ ├── favicon.ico │ ├── help.html │ ├── help │ │ └── _posts │ │ │ ├── 2010-01-01-getting-started.markdown │ │ │ ├── 2010-01-02-creating-a-substitute.markdown │ │ │ ├── 2010-02-01-set-return-value.markdown │ │ │ ├── 2010-02-02-return-for-args.markdown │ │ │ ├── 2010-02-03-return-for-any-args.markdown │ │ │ ├── 2010-02-03-return-from-function.markdown │ │ │ ├── 2010-02-04-multiple-returns.markdown │ │ │ ├── 2010-02-10-replacing-return-values.markdown │ │ │ ├── 2010-03-01-received-calls.markdown │ │ │ ├── 2010-03-10-clear-received-calls.markdown │ │ │ ├── 2010-04-01-argument-matchers.markdown │ │ │ ├── 2010-05-01-callbacks.markdown │ │ │ ├── 2010-05-02-throwing-exceptions.markdown │ │ │ ├── 2010-06-01-raising-events.markdown │ │ │ ├── 2010-10-01-auto-and-recursive-mocks.markdown │ │ │ ├── 2010-11-01-setting-out-and-ref-arguments.markdown │ │ │ ├── 2010-12-01-actions-with-arguments.markdown │ │ │ ├── 2013-01-01-received-in-order.markdown │ │ │ ├── 2013-02-01-partial-subs.markdown │ │ │ ├── 2013-03-01-return-for-all.markdown │ │ │ └── 2013-04-01-threading.markdown │ ├── images │ │ ├── NSubstitute.ai │ │ ├── github-16x16.png │ │ ├── nsubstitute-100x100.png │ │ ├── nsubstitute-16x16.png │ │ ├── nsubstitute-32x32.png │ │ ├── nuget-16x16.png │ │ ├── teamcity-16x16.png │ │ └── teamcity-32x32.png │ ├── index.html │ └── scripts │ │ ├── shAutoloader.js │ │ ├── shBrushCSharp.js │ │ ├── shCore.js │ │ └── shLegacy.js ├── NSubstitute.2010.sln ├── NSubstitute.Acceptance.Specs.NET │ └── NSubstitute.Acceptance.Specs.NET.csproj ├── NSubstitute.Acceptance.Specs │ ├── ArgDoFromMatcher.cs │ ├── ArgumentInvocationFromMatchers.cs │ ├── ArgumentMatching.cs │ ├── AutoValuesForSubs.cs │ ├── CallbackCalling.cs │ ├── ClearSubstitute.cs │ ├── ConcurrencyTests.cs │ ├── CustomHandlersSpecs.cs │ ├── DynamicCalls.cs │ ├── EventChecking.cs │ ├── EventRaising.cs │ ├── ExceptionsWhenCheckingReceivedCalls.cs │ ├── ExceptionsWhenCheckingSequencesOfCalls.cs │ ├── FieldReports │ │ ├── ArgMatchingWithNestedSubCalls.cs │ │ ├── ArgMatchingWithValueTypeArgSpecsForObjectArguments.cs │ │ ├── CallingIntoNewSubWithinReturns.cs │ │ ├── DisposeWithThreadLocal.cs │ │ ├── EqualsBehaviourOnClassSubs.cs │ │ ├── ExceptionsThrownFromCustomArgumentMatchers.cs │ │ ├── Issue110_CustomExceptions.cs │ │ ├── Issue111_ArgMatchesWithRefAndOutParams.cs │ │ ├── Issue114_ArgumentCheckOfOptionalParameter.cs │ │ ├── Issue118_ConcreteClassWithPublicStaticMethod.cs │ │ ├── Issue125_MethodWithSealedClassReturnType.cs │ │ ├── Issue129_AmbiguousArgsWithOutRef.cs │ │ ├── Issue149_ArgMatcherInReturns.cs │ │ ├── Issue170_MultidimensionalArray.cs │ │ ├── Issue211_ReceivedInOrderParamsFormatting.cs │ │ ├── Issue237_ReceivedInOrderErrorHandling.cs │ │ ├── Issue271_DelegateOutArgument.cs │ │ ├── Issue282_MultipleReturnValuesParallelism.cs │ │ ├── Issue33_RaisingINotifyPropertyChangedEvents.cs │ │ ├── Issue38_SettingNullReturnValue.cs │ │ ├── Issue45_CallInfoArgAccessFailsForNull.cs │ │ ├── Issue47_RaisingEventsWithNullArg.cs │ │ ├── Issue57_SettingVirtualPropertyInCtor.cs │ │ ├── Issue59_ArgDoWithReturns.cs │ │ ├── Issue61_ArgAnyStringRegression.cs │ │ ├── Issue75_DoesNotWorkWithMembersThatUseDynamic.cs │ │ ├── Issue77_EqualsBehaviourOnClassStubs.cs │ │ ├── Issue83_MethodsWithGenericStructConstraint.cs │ │ ├── Issue_RaiseEventOnNonSubstitute.cs │ │ ├── Regression_ReceivedClearsStub.cs │ │ ├── StaticStateBleeding.cs │ │ └── SubbingSynchronizationContext.cs │ ├── FormattingCallsWhenThrowingReceivedCallsExceptions.cs │ ├── Infrastructure │ │ ├── FluentSomething.cs │ │ ├── IFluentSomething.cs │ │ ├── ISomething.cs │ │ ├── PendingAttribute.cs │ │ ├── SomeClass.cs │ │ └── Task.cs │ ├── MatchingDerivedTypesForGenerics.cs │ ├── MultipleThreads.cs │ ├── NSubstitute.Acceptance.Specs.xproj │ ├── NotASubstituteExceptions.cs │ ├── NullReferenceCheckingForSubstituteExtensions.cs │ ├── OutAndRefParameters.cs │ ├── PartialSubExamples.cs │ ├── PartialSubs.cs │ ├── PerfTests.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── PropertyBehaviour.cs │ ├── ReceivedCalls.cs │ ├── RecursiveSubs.cs │ ├── ReturningResults.cs │ ├── ReturnsAndDoes.cs │ ├── ReturnsForAll.cs │ ├── ReturnsForAllFromFunc.cs │ ├── SequenceChecking.cs │ ├── SimpleSubstituteExamples.cs │ ├── SubbingForConcreteTypesAndMultipleInterfaces.cs │ ├── SubbingForEventHandler.cs │ ├── SubstituteTimingAndInteractions.cs │ ├── SubstitutingForDelegates.cs │ ├── ThrowingExceptions.cs │ ├── WhenCalledDo.cs │ └── project.json ├── NSubstitute.NET │ ├── NSubstitute.NET.csproj │ └── ilmerge.exclude ├── NSubstitute.NETCore.sln ├── NSubstitute.Specs │ ├── AnonymousObserver.cs │ ├── ArgumentSpecs.cs │ ├── Arguments │ │ ├── ArgumentSpecificationFactorySpecs.cs │ │ ├── ArgumentSpecificationSpecs.cs │ │ ├── ArgumentSpecificationsFactorySpecs.cs │ │ ├── ArrayArgumentSpecificationsFactorySpecs.cs │ │ ├── ArrayContentsArgumentMatcherSpecs.cs │ │ ├── DefaultCheckerSpecs.cs │ │ ├── EqualsArgumentMatcherSpecs.cs │ │ ├── ExpressionArgumentMatcherSpecs.cs │ │ ├── MixedArgumentSpecificationsFactorySpecs.cs │ │ ├── NonParamsArgumentSpecificationFactorySpecs.cs │ │ ├── ParameterInfosFromParamsArrayFactorySpecs.cs │ │ ├── ParamsArgumentSpecificationFactorySpecs.cs │ │ ├── SuppliedArgumentSpecificationsFactorySpecs.cs │ │ └── SuppliedArgumentSpecificationsSpecs.cs │ ├── CallActionsSpecs.cs │ ├── CallBaseExclusionsSpecs.cs │ ├── CallCollectionSpecs.cs │ ├── CallFactorySpecs.cs │ ├── CallFormatterSpecs.cs │ ├── CallInfoFactorySpecs.cs │ ├── CallInfoSpecs.cs │ ├── CallResultsSpecs.cs │ ├── CallRouterResolverSpecs.cs │ ├── CallRouterSpecs.cs │ ├── CallSpecificationFactorySpecs.cs │ ├── CallSpecificationSpecs.cs │ ├── ClearSubstituteExtensionSpec.cs │ ├── ConfigureCallSpecs.cs │ ├── DefaultForTypeSpecs.cs │ ├── DidNotReceiveExtensionsSpecs.cs │ ├── DidNotReceiveWithAnyArgsExtensionSpec.cs │ ├── EventHandlerRegistrySpec.cs │ ├── ExceptionsSpecs.cs │ ├── ExtensionsSpecs.cs │ ├── GetCallSpecSpecs.cs │ ├── Infrastructure │ │ ├── BaseConcern.cs │ │ ├── ConcernFor.cs │ │ ├── ITemporaryChange.cs │ │ ├── MockingAdaptor.cs │ │ ├── ReflectionHelper.cs │ │ ├── StaticConcern.cs │ │ ├── TemporaryChange.cs │ │ ├── TemporaryChangeNotConfiguredProperlyException.cs │ │ ├── TemporaryChangeToBuilder.cs │ │ ├── TestCallRouter.cs │ │ └── Tests │ │ │ ├── BaseConcernSpecs.cs │ │ │ └── ReflectionHelperSpecs.cs │ ├── NSubstitute.Specs.csproj │ ├── PendingSpecificationSpecs.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── PropertyHelperSpecs.cs │ ├── Proxies │ │ ├── CastleDynamicProxy │ │ │ └── CastleDynamicProxyFactorySpecs.cs │ │ ├── DelegateProxy │ │ │ └── DelegateProxyFactorySpecs.cs │ │ └── ProxyFactorySpecs.cs │ ├── QuantitySpecs.cs │ ├── ReceivedCallsExceptionThrowerSpecs.cs │ ├── ReceivedCallsExtensionSpec.cs │ ├── ReceivedExtensionSpec.cs │ ├── ReceivedWithAnyArgsExtensionSpec.cs │ ├── ReflectionExtensionsSpecs.cs │ ├── ResultsForTypeSpec.cs │ ├── ReturnExtensionSpec.cs │ ├── ReturnValueFromFuncSpec.cs │ ├── ReturnsForAllExtensionSpecs.cs │ ├── ReturnsForAllFuncExtensionSpecs.cs │ ├── Routing │ │ ├── AutoValues │ │ │ ├── AutoArrayProviderSpecs.cs │ │ │ ├── AutoQueryableProviderSpecs.cs │ │ │ ├── AutoStringProviderSpecs.cs │ │ │ ├── AutoSubstituteProviderSpecs.cs │ │ │ └── AutoTaskProviderSpecs.cs │ │ ├── Handlers │ │ │ ├── AddCallToQueryResultHandlerSpecs.cs │ │ │ ├── CheckReceivedCallHandlerSpecs.cs │ │ │ ├── ClearLastCallRouterHandlerSpecs.cs │ │ │ ├── DoActionsCallHandlerSpecs.cs │ │ │ ├── EventSubscriptionHandlerSpec.cs │ │ │ ├── PropertySetterHandlerSpecs.cs │ │ │ ├── RaiseEventHandlerSpec.cs │ │ │ ├── RecordCallHandlerSpecs.cs │ │ │ ├── ReturnAutoValueSpecs.cs │ │ │ ├── ReturnConfiguredResultHandlerSpecs.cs │ │ │ ├── ReturnDefaultForReturnTypeHandlerSpecs.cs │ │ │ ├── ReturnResultForTypeHandlerSpecs.cs │ │ │ └── SetActionsForCallHandlerSpecs.cs │ │ └── RouteSpecs.cs │ ├── SampleStructures │ │ ├── Foo.cs │ │ └── IFoo.cs │ ├── SequenceChecking │ │ └── InstanceTrackerSpecs.cs │ ├── SubstituteFactorySpecs.cs │ ├── SubstituteSpecs.cs │ ├── SubstitutionContextSpecs.cs │ └── WhenCalledSpecs.cs ├── NSubstitute │ ├── Arg.cs │ ├── Callback.cs │ ├── Callbacks │ │ └── ConfiguredCallback.cs │ ├── ClearOptions.cs │ ├── Core │ │ ├── Argument.cs │ │ ├── Arguments │ │ │ ├── AnyArgumentMatcher.cs │ │ │ ├── ArgumentAction.cs │ │ │ ├── ArgumentEqualsSpecificationFactory.cs │ │ │ ├── ArgumentFormatter.cs │ │ │ ├── ArgumentMatchInfo.cs │ │ │ ├── ArgumentSpecification.cs │ │ │ ├── ArgumentSpecificationFactory.cs │ │ │ ├── ArgumentSpecificationQueue.cs │ │ │ ├── ArgumentSpecificationsFactory.cs │ │ │ ├── ArrayArgumentSpecificationsFactory.cs │ │ │ ├── ArrayContentsArgumentMatcher.cs │ │ │ ├── ArrayContentsArgumentSpecificationFactory.cs │ │ │ ├── DefaultChecker.cs │ │ │ ├── EqualsArgumentMatcher.cs │ │ │ ├── ExpressionArgumentMatcher.cs │ │ │ ├── IArgumentEqualsSpecificationFactory.cs │ │ │ ├── IArgumentFormatter.cs │ │ │ ├── IArgumentMatcher.cs │ │ │ ├── IArgumentSpecification.cs │ │ │ ├── IArgumentSpecificationFactory.cs │ │ │ ├── IArgumentSpecificationsFactory.cs │ │ │ ├── IArrayArgumentSpecificationsFactory.cs │ │ │ ├── IArrayContentsArgumentSpecificationFactory.cs │ │ │ ├── IDefaultChecker.cs │ │ │ ├── IMixedArgumentSpecificationsFactory.cs │ │ │ ├── INonParamsArgumentSpecificationFactory.cs │ │ │ ├── IParameterInfosFromParamsArrayFactory.cs │ │ │ ├── IParamsArgumentSpecificationFactory.cs │ │ │ ├── ISuppliedArgumentSpecifications.cs │ │ │ ├── ISuppliedArgumentSpecificationsFactory.cs │ │ │ ├── MixedArgumentSpecificationsFactory.cs │ │ │ ├── NonParamsArgumentSpecificationFactory.cs │ │ │ ├── ParameterInfosFromParamsArrayFactory.cs │ │ │ ├── ParamsArgumentSpecificationFactory.cs │ │ │ ├── SuppliedArgumentSpecifications.cs │ │ │ └── SuppliedArgumentSpecificationsFactory.cs │ │ ├── Call.cs │ │ ├── CallActions.cs │ │ ├── CallBaseExclusions.cs │ │ ├── CallCollection.cs │ │ ├── CallFactory.cs │ │ ├── CallFormatter.cs │ │ ├── CallInfo.cs │ │ ├── CallInfoFactory.cs │ │ ├── CallResults.cs │ │ ├── CallRouter.cs │ │ ├── CallRouterFactory.cs │ │ ├── CallRouterResolver.cs │ │ ├── CallSpecAndTarget.cs │ │ ├── CallSpecification.cs │ │ ├── CallSpecificationFactory.cs │ │ ├── CallSpecificationFactoryFactoryYesThatsRight.cs │ │ ├── ConfigureCall.cs │ │ ├── ConfiguredCall.cs │ │ ├── CustomHandlers.cs │ │ ├── DefaultForType.cs │ │ ├── EventCallFormatter.cs │ │ ├── EventHandlerRegistry.cs │ │ ├── Events │ │ │ ├── DelegateEventWrapper.cs │ │ │ ├── EventHandlerWrapper.cs │ │ │ └── RaiseEventWrapper.cs │ │ ├── Extensions.cs │ │ ├── GetCallSpec.cs │ │ ├── ICall.cs │ │ ├── ICallActions.cs │ │ ├── ICallBaseExclusions.cs │ │ ├── ICallCollection.cs │ │ ├── ICallHandler.cs │ │ ├── ICallInfoFactory.cs │ │ ├── ICallResults.cs │ │ ├── ICallRouter.cs │ │ ├── ICallRouterFactory.cs │ │ ├── ICallRouterProvider.cs │ │ ├── ICallRouterResolver.cs │ │ ├── ICallSpecification.cs │ │ ├── ICallSpecificationFactory.cs │ │ ├── IConfigureCall.cs │ │ ├── ICustomHandlers.cs │ │ ├── IDefaultForType.cs │ │ ├── IDescribeNonMatches.cs │ │ ├── IEventHandlerRegistry.cs │ │ ├── IGetCallSpec.cs │ │ ├── IMethodInfoFormatter.cs │ │ ├── IParameterInfo.cs │ │ ├── IPendingSpecification.cs │ │ ├── IPropertyHelper.cs │ │ ├── IProxyFactory.cs │ │ ├── IQueryResults.cs │ │ ├── IReceivedCalls.cs │ │ ├── IReceivedCallsExceptionThrower.cs │ │ ├── IResultsForType.cs │ │ ├── IReturn.cs │ │ ├── ISubstituteFactory.cs │ │ ├── ISubstituteState.cs │ │ ├── ISubstitutionContext.cs │ │ ├── MatchArgs.cs │ │ ├── Maybe.cs │ │ ├── MethodFormatter.cs │ │ ├── ParameterInfoFromType.cs │ │ ├── ParameterInfoWrapper.cs │ │ ├── PendingSpecification.cs │ │ ├── PendingSpecificationInfo.cs │ │ ├── PropertyCallFormatter.cs │ │ ├── PropertyHelper.cs │ │ ├── Quantity.cs │ │ ├── Query.cs │ │ ├── ReceivedCallsExceptionThrower.cs │ │ ├── ReflectionExtensions.cs │ │ ├── ResultsForType.cs │ │ ├── ReturnObservable.cs │ │ ├── RobustThreadLocal.cs │ │ ├── RouteAction.cs │ │ ├── SequenceChecking │ │ │ ├── InstanceTracker.cs │ │ │ ├── SequenceFormatter.cs │ │ │ └── SequenceInOrderAssertion.cs │ │ ├── SequenceNumberGenerator.cs │ │ ├── SubstituteConfig.cs │ │ ├── SubstituteFactory.cs │ │ ├── SubstituteState.cs │ │ ├── SubstitutionContext.cs │ │ └── WhenCalled.cs │ ├── Exceptions │ │ ├── AmbiguousArgumentsException.cs │ │ ├── ArgumentIsNotOutOrRefException.cs │ │ ├── ArgumentNotFoundException.cs │ │ ├── ArgumentSetWithIncompatibleValueException.cs │ │ ├── CallSequenceNotFoundException.cs │ │ ├── CanNotPartiallySubForInterfaceOrDelegateException.cs │ │ ├── CannotCreateEventArgsException.cs │ │ ├── CannotReturnNullforValueType.cs │ │ ├── CouldNotRaiseEventException.cs │ │ ├── CouldNotSetReturnException.cs │ │ ├── MissingSequenceNumberException.cs │ │ ├── NotASubstituteException.cs │ │ ├── NotRunningAQueryException.cs │ │ ├── NullSubstituteReferenceException.cs │ │ ├── ReceivedCallsException.cs │ │ ├── SubstituteException.cs │ │ ├── SubstituteInternalException.cs │ │ └── UnexpectedArgumentMatcherException.cs │ ├── Experimental │ │ └── Received.cs │ ├── Extensions │ │ ├── ClearExtensions.cs │ │ ├── ExceptionExtensions.cs │ │ ├── ReturnsExtensions.cs │ │ └── ReturnsForAllExtensions.cs │ ├── Internal │ │ └── TypeExtensions.cs │ ├── NSubstitute.csproj │ ├── NSubstitute.xproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Proxies │ │ ├── CastleDynamicProxy │ │ │ ├── CastleDynamicProxyFactory.cs │ │ │ ├── CastleForwardingInterceptor.cs │ │ │ ├── CastleInvocationMapper.cs │ │ │ └── CastlePatchedInterceptorRegistry.cs │ │ ├── DelegateProxy │ │ │ ├── DelegateCall.cs │ │ │ └── DelegateProxyFactory.cs │ │ └── ProxyFactory.cs │ ├── Raise.cs │ ├── Received.cs │ ├── Routing │ │ ├── AutoValues │ │ │ ├── AutoArrayProvider.cs │ │ │ ├── AutoObservableProvider.cs │ │ │ ├── AutoQueryableProvider.cs │ │ │ ├── AutoStringProvider.cs │ │ │ ├── AutoSubstituteProvider.cs │ │ │ ├── AutoTaskProvider.cs │ │ │ └── IAutoValueProvider.cs │ │ ├── Handlers │ │ │ ├── AddCallToQueryResultHandler.cs │ │ │ ├── CheckReceivedCallsHandler.cs │ │ │ ├── ClearLastCallRouterHandler.cs │ │ │ ├── ClearUnusedCallSpecHandler.cs │ │ │ ├── DoActionsCallHandler.cs │ │ │ ├── DoNotCallBaseForCallHandler.cs │ │ │ ├── EventSubscriptionHandler.cs │ │ │ ├── PropertySetterHandler.cs │ │ │ ├── RaiseEventHandler.cs │ │ │ ├── RecordCallHandler.cs │ │ │ ├── RecordCallSpecificationHandler.cs │ │ │ ├── ReturnAutoValue.cs │ │ │ ├── ReturnConfiguredResultHandler.cs │ │ │ ├── ReturnDefaultForReturnTypeHandler.cs │ │ │ ├── ReturnFromAndConfigureDynamicCall.cs │ │ │ ├── ReturnFromBaseIfRequired.cs │ │ │ ├── ReturnFromCustomHandlers.cs │ │ │ ├── ReturnResultForTypeHandler.cs │ │ │ ├── SetActionForCallHandler.cs │ │ │ └── TrackLastCallHandler.cs │ │ ├── IRoute.cs │ │ ├── IRouteFactory.cs │ │ ├── Route.cs │ │ └── RouteFactory.cs │ ├── Substitute.cs │ ├── SubstituteExtensions.cs │ └── project.json ├── Weavers │ ├── Common.targets │ ├── NSubstitute.Weaver.App │ │ ├── App.config │ │ ├── NSubstitute.Weaver.App.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Weaver.cs │ ├── NSubstitute.Weaver.Tests.Fody │ │ ├── ModuleWeaver.cs │ │ ├── NSubstitute.Weaver.Tests.Fody.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── NSubstitute.Weaver.Tests │ │ ├── FodyWeaver │ │ │ └── FodyWeaverTests.cs │ │ ├── MockWeaver │ │ │ ├── BasicTests.cs │ │ │ ├── BasicTypes.cs │ │ │ ├── Hackweek │ │ │ │ ├── AdvancedMatching.cs │ │ │ │ ├── AdvancedMatchingTests.cs │ │ │ │ ├── Calculator.cs │ │ │ │ ├── CalculatorTests.cs │ │ │ │ ├── Experiment.cs │ │ │ │ ├── ExperimentTests.cs │ │ │ │ ├── ICalculator.cs │ │ │ │ ├── ICalculatorTests.cs │ │ │ │ ├── OutParam.cs │ │ │ │ ├── OutParamTests.cs │ │ │ │ ├── Struct.cs │ │ │ │ ├── StructTest.cs │ │ │ │ └── _Disabled │ │ │ │ │ └── MathfTests.cs │ │ │ └── MockWeaverTests.cs │ │ ├── MscorlibWeaver │ │ │ ├── Hackweek │ │ │ │ └── _Disabled │ │ │ │ │ ├── DemoTests.cs │ │ │ │ │ └── MscorlibTests.cs │ │ │ ├── ResolverTestBase.cs │ │ │ ├── ResolverTestForMethods.cs │ │ │ └── ResolverTestForTypes.cs │ │ ├── NSubstitute.Weaver.Tests.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── app.config │ │ └── packages.config │ ├── NSubstitute.Weaver │ │ ├── CecilExtensions.cs │ │ ├── FodyWeaver │ │ │ └── ModuleWeaver.cs │ │ ├── MockWeaver │ │ │ ├── MockInjectorVisitor.cs │ │ │ └── MockWeaver.cs │ │ ├── MscorlibWeaver │ │ │ ├── CallSiteWeaver │ │ │ │ ├── CallSiteWeaver.cs │ │ │ │ └── Resolver.cs │ │ │ └── MscorlibWrapper │ │ │ │ ├── Copier.cs │ │ │ │ ├── ProcessTypeResolver.cs │ │ │ │ └── Wrapper.cs │ │ ├── NSubstitute.Weaver.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── Unity.Cecil.Visitor.Tests │ │ ├── Fixture.cs │ │ ├── TestVisitor.cs │ │ ├── TracingVisitor.cs │ │ ├── Unity.Cecil.Visitor.Tests.csproj │ │ └── packages.config │ └── Unity.Cecil.Visitor │ │ ├── Extensions.cs │ │ ├── TypeReferenceExtensions.cs │ │ ├── Unity.Cecil.Visitor.csproj │ │ ├── Visitor.cs │ │ └── packages.config └── nsubstitute.snk ├── ThirdParty ├── 7z │ ├── 7z.dll │ ├── 7z.exe │ └── License.txt ├── Castle.Core.4.0.0 │ ├── ASL - Apache Software Foundation License.txt │ ├── lib │ │ ├── net35 │ │ │ ├── Castle.Core.dll │ │ │ ├── Castle.Core.pdb │ │ │ ├── Castle.Core.xml │ │ │ ├── Castle.Services.Logging.Log4netIntegration.dll │ │ │ ├── Castle.Services.Logging.Log4netIntegration.pdb │ │ │ ├── Castle.Services.Logging.NLogIntegration.dll │ │ │ └── Castle.Services.Logging.NLogIntegration.pdb │ │ ├── net40-client │ │ │ ├── Castle.Core.dll │ │ │ ├── Castle.Core.pdb │ │ │ ├── Castle.Core.xml │ │ │ ├── Castle.Services.Logging.NLogIntegration.dll │ │ │ └── Castle.Services.Logging.NLogIntegration.pdb │ │ ├── net40 │ │ │ ├── Castle.Services.Logging.Log4netIntegration.dll │ │ │ └── Castle.Services.Logging.Log4netIntegration.pdb │ │ └── net45 │ │ │ ├── Castle.Core.dll │ │ │ ├── Castle.Core.pdb │ │ │ ├── Castle.Core.xml │ │ │ ├── Castle.Services.Logging.Log4netIntegration.dll │ │ │ ├── Castle.Services.Logging.Log4netIntegration.pdb │ │ │ ├── Castle.Services.Logging.NLogIntegration.dll │ │ │ ├── Castle.Services.Logging.NLogIntegration.pdb │ │ │ ├── Castle.Services.Logging.SerilogIntegration.dll │ │ │ └── Castle.Services.Logging.SerilogIntegration.pdb │ └── readme.txt ├── FAKE.Dotnet │ └── FAKE.Dotnet │ │ ├── FAKE.Dotnet.nupkg │ │ └── tools │ │ ├── FSharp.Data.DesignTime.dll │ │ ├── FSharp.Data.DesignTime.pdb │ │ ├── FSharp.Data.DesignTime.xml │ │ ├── FSharp.Data.dll │ │ ├── FSharp.Data.pdb │ │ ├── FSharp.Data.xml │ │ ├── Fake.Dotnet.XML │ │ ├── Fake.Dotnet.dll │ │ └── Fake.Dotnet.pdb ├── FAKE │ └── FAKE.Core │ │ ├── FAKE.Core.nupkg │ │ └── tools │ │ ├── Argu.dll │ │ ├── Argu.pdb │ │ ├── Argu.xml │ │ ├── FAKE.FSharp.Compiler.Service.dll │ │ ├── FAKE.exe │ │ ├── FAKE.exe.config │ │ ├── FAKE.pdb │ │ ├── FAKE.pdb.srcsrv │ │ ├── FSharp.Compiler.Service.dll │ │ ├── FSharp.Compiler.Service.pdb │ │ ├── FSharp.Compiler.Service.xml │ │ ├── FSharp.Core.dll │ │ ├── FSharp.Core.optdata │ │ ├── FSharp.Core.sigdata │ │ ├── FSharp.Core.xml │ │ ├── FakeLib.XML │ │ ├── FakeLib.dll │ │ ├── FakeLib.dll.config │ │ ├── FakeLib.pdb │ │ ├── FakeLib.pdb.srcsrv │ │ ├── HashLib.dll │ │ ├── ICSharpCode.SharpZipLib.dll │ │ ├── License.txt │ │ ├── Microsoft.Web.XmlTransform.dll │ │ ├── Mono.Cecil.Mdb.dll │ │ ├── Mono.Cecil.Pdb.dll │ │ ├── Mono.Cecil.Rocks.dll │ │ ├── Mono.Cecil.dll │ │ ├── Newtonsoft.Json.dll │ │ ├── Newtonsoft.Json.xml │ │ ├── NuGet.Core.dll │ │ ├── README.markdown │ │ ├── RELEASE_NOTES.md │ │ ├── UnionArgParser.dll │ │ ├── UnionArgParser.pdb │ │ └── UnionArgParser.xml ├── ILMerge │ ├── ILMerge License.rtf │ ├── ILMerge.doc │ └── ILMerge.exe ├── LinFu-2.2.0.0 │ ├── LinFu.Core.dll │ └── LinFu.Core.xml ├── NUnit.Silverlight │ ├── Microsoft.Silverlight.Testing.dll │ ├── Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll │ ├── NUnit.Silverlight.Compatibility.dll │ ├── NUnit.Silverlight.Framework.dll │ ├── NUnit.Silverlight.Metadata.dll │ └── README.txt ├── NUnit │ ├── Logo.ico │ ├── NUnitFitTests.html │ ├── bin │ │ └── net-2.0 │ │ │ ├── NUnitFitTests.html │ │ │ ├── NUnitTests.config │ │ │ ├── NUnitTests.nunit │ │ │ ├── agent.conf │ │ │ ├── agent.log.conf │ │ │ ├── framework │ │ │ ├── nunit.framework.dll │ │ │ ├── nunit.framework.xml │ │ │ ├── nunit.mocks.dll │ │ │ └── pnunit.framework.dll │ │ │ ├── launcher.log.conf │ │ │ ├── lib │ │ │ ├── Failure.png │ │ │ ├── Ignored.png │ │ │ ├── Inconclusive.png │ │ │ ├── Skipped.png │ │ │ ├── Success.png │ │ │ ├── fit.dll │ │ │ ├── log4net.dll │ │ │ ├── nunit-console-runner.dll │ │ │ ├── nunit-gui-runner.dll │ │ │ ├── nunit.core.dll │ │ │ ├── nunit.core.interfaces.dll │ │ │ ├── nunit.fixtures.dll │ │ │ ├── nunit.uiexception.dll │ │ │ ├── nunit.uikit.dll │ │ │ └── nunit.util.dll │ │ │ ├── nunit-agent-x86.exe │ │ │ ├── nunit-agent-x86.exe.config │ │ │ ├── nunit-agent.exe │ │ │ ├── nunit-agent.exe.config │ │ │ ├── nunit-console-x86.exe │ │ │ ├── nunit-console-x86.exe.config │ │ │ ├── nunit-console.exe │ │ │ ├── nunit-console.exe.config │ │ │ ├── nunit-x86.exe │ │ │ ├── nunit-x86.exe.config │ │ │ ├── nunit.exe │ │ │ ├── nunit.exe.config │ │ │ ├── nunit.framework.dll │ │ │ ├── pnunit-agent.exe │ │ │ ├── pnunit-agent.exe.config │ │ │ ├── pnunit-launcher.exe │ │ │ ├── pnunit-launcher.exe.config │ │ │ ├── pnunit.framework.dll │ │ │ ├── pnunit.tests.dll │ │ │ ├── runFile.exe │ │ │ ├── runFile.exe.config │ │ │ ├── runpnunit.bat │ │ │ ├── test.conf │ │ │ └── tests │ │ │ ├── loadtest-assembly.dll │ │ │ ├── mock-assembly.dll │ │ │ ├── nonamespace-assembly.dll │ │ │ ├── nunit-console.tests.dll │ │ │ ├── nunit-gui.tests.dll │ │ │ ├── nunit.core.tests.dll │ │ │ ├── nunit.fixtures.tests.dll │ │ │ ├── nunit.framework.dll │ │ │ ├── nunit.framework.tests.dll │ │ │ ├── nunit.mocks.tests.dll │ │ │ ├── nunit.uiexception.tests.dll │ │ │ ├── nunit.uikit.tests.dll │ │ │ ├── nunit.util.tests.dll │ │ │ ├── test-assembly.dll │ │ │ ├── test-utilities.dll │ │ │ └── timing-tests.dll │ ├── fit-license.txt │ ├── license.txt │ └── nunit-2.5.10.11092.txt ├── NuGet │ ├── LICENSE.txt │ └── NuGet.exe ├── RhinoMocks │ ├── Rhino.Mocks.dll │ ├── Rhino.Mocks.xml │ ├── Silverlight │ │ ├── Castle.Core-Silverlight.dll │ │ ├── Castle.Core-Silverlight.pdb │ │ ├── Castle.DynamicProxy-Silverlight.dll │ │ ├── Castle.DynamicProxy-Silverlight.pdb │ │ ├── Rhino.Mocks 3.5.Silverlight.dll │ │ └── Rhino.Mocks 3.5.Silverlight.pdb │ ├── acknowledgements.txt │ └── license.txt ├── Rx │ ├── System.Threading.dll │ ├── System.Threading.xml │ ├── eula.txt │ └── redist.txt └── pretzel │ └── Pretzel.exe ├── acknowledgements.markdown ├── appveyor.yml ├── build.bat ├── build.fsx ├── build.sh ├── global.json ├── update-fake.bat └── update-fake.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | # Ensure eol normalization 2 | * text=auto 3 | 4 | # These files are text and should be normalized (convert crlf => lf) 5 | *.cs text diff=csharp 6 | *.xaml text 7 | *.config text 8 | *.csproj text 9 | *.sln text 10 | *.tt text 11 | *.ps1 text 12 | *.cmd text 13 | *.bat text 14 | *.msbuild text 15 | *.md text 16 | *.targets text 17 | 18 | # Images should be treated as binary 19 | # (binary is a macro for -text -diff) 20 | *.png binary 21 | *.jpeg binary 22 | *.exe binary 23 | *.dll binary 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #comment 2 | *.user 3 | *.suo 4 | *.orig 5 | *.swp 6 | *.swo 7 | *.dotcover 8 | bin/ 9 | obj/ 10 | Output/* 11 | *.sln.cache 12 | Source/Docs/_site 13 | Bin/ 14 | _ReSharper* 15 | .DS_Store 16 | Source/packages 17 | project.lock.json 18 | .vs/ 19 | .fake/ 20 | .idea/ 21 | -------------------------------------------------------------------------------- /.hgeol: -------------------------------------------------------------------------------- 1 | [repository] 2 | native = LF 3 | [patterns] 4 | **.py = LF 5 | **.pl = LF 6 | **.pm = LF 7 | **.t = LF 8 | **.it = LF 9 | **.h = LF 10 | **.cpp = LF 11 | **.cs = LF 12 | **.c = LF 13 | **.txt = LF 14 | **.bindings = LF 15 | **.sh = LF 16 | **.jam = LF 17 | **.as = LF 18 | **.boo = LF 19 | **.java = LF 20 | **.js = LF 21 | Makefile = LF 22 | **.shader = LF 23 | **.cginc = LF 24 | **.glslinc = LF 25 | **.mm = LF 26 | Runtime/Export/common_* = LF 27 | Repositories.ini = LF 28 | .hgignore = LF 29 | 30 | ## keep CRLF's in sync with .editorconfig 31 | 32 | # vs can handle these as lf, but really wants them as crlf 33 | **.vcproj = CRLF 34 | **.vcxproj = CRLF 35 | **.vcxproj.filters = CRLF 36 | **.csproj = CRLF 37 | **.props = CRLF 38 | **.targets = CRLF 39 | **.sln = CRLF 40 | **.sln.template = CRLF 41 | **.bat = CRLF 42 | **.cmd = CRLF 43 | **.xaml = CRLF 44 | # the text templating parser will actually fail on lf, inexplicably setting every #line directive as '1' 45 | **.tt = CRLF 46 | **.t4 = CRLF 47 | **.ttinclude = CRLF 48 | 49 | [eol] 50 | only-consistent = False 51 | -------------------------------------------------------------------------------- /.repoconfig: -------------------------------------------------------------------------------- 1 | [version] 2 | repoconfig=3 3 | 4 | [format] 5 | path-include = ^Source/Weavers/ # limit to our own new stuff and leave the rest alone 6 | path-ignore = < 2 | 3 | 4 | NSubstitute 5 | 0.9.0 6 | NSubstitute is a friendly substitute for .NET mocking frameworks. It has a simple, succinct syntax to help developers write clearer tests. NSubstitute is designed for Arrange-Act-Assert (AAA) testing and with Test Driven Development (TDD) in mind. 7 | Anthony Egerton,David Tchepak,Alexandr Nikitin 8 | mocking mocks testing unit-testing TDD AAA 9 | http://nsubstitute.github.com 10 | https://github.com/nsubstitute/NSubstitute/raw/master/LICENSE.txt 11 | false 12 | http://nsubstitute.github.com/images/nsubstitute-100x100.png 13 | @dependencies@ 14 | 15 | 16 | -------------------------------------------------------------------------------- /Build/NSubstitute.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(MSBuildProgramFiles32) 6 | 7 | $(ProgramFiles%28x86%29) 8 | $(ProgramFiles) 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Build/samples.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | gem "rake" 3 | gem "liquid", "2.2.2" 4 | gem "jekyll", "0.11.0" 5 | 6 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | albino (1.3.3) 5 | posix-spawn (>= 0.3.6) 6 | classifier (1.3.3) 7 | fast-stemmer (>= 1.0.0) 8 | directory_watcher (1.4.1) 9 | fast-stemmer (1.0.1) 10 | jekyll (0.11.0) 11 | albino (>= 1.3.2) 12 | classifier (>= 1.3.1) 13 | directory_watcher (>= 1.1.1) 14 | kramdown (>= 0.13.2) 15 | liquid (>= 1.9.0) 16 | maruku (>= 0.5.9) 17 | kramdown (0.14.1) 18 | liquid (2.2.2) 19 | maruku (0.6.1) 20 | syntax (>= 1.0.0) 21 | posix-spawn (0.3.6) 22 | rake (10.0.0) 23 | syntax (1.0.0) 24 | 25 | PLATFORMS 26 | x86-mingw32 27 | 28 | DEPENDENCIES 29 | jekyll (= 0.11.0) 30 | liquid (= 2.2.2) 31 | rake 32 | 33 | BUNDLED WITH 34 | 1.14.6 35 | -------------------------------------------------------------------------------- /NSubstitute.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": 3 | [ 4 | { 5 | "path": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /Source/Docs/_config.yml: -------------------------------------------------------------------------------- 1 | pygments: false 2 | permalink: /:categories/:title 3 | lsi: false 4 | -------------------------------------------------------------------------------- /Source/Docs/_layouts/post.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 |
6 |
7 |
    8 | {% for post in site.categories.help reversed %} 9 |
  • {{ post.title }}
  • 10 | {% endfor %} 11 |
12 |
13 | 14 |
15 |

{{ page.title }}

16 | {{ content }} 17 | 29 |
30 |
31 | 32 | -------------------------------------------------------------------------------- /Source/Docs/_plugins/examplecode.rb: -------------------------------------------------------------------------------- 1 | module Jekyll 2 | class ExampleCodeBlock < Liquid::Block 3 | include Liquid::StandardFilters 4 | def render(context) 5 | code = super.join 6 | <<-HTML 7 |
8 |
#{h(code).strip}
9 |
10 | HTML 11 | end 12 | end 13 | end 14 | Liquid::Template.register_tag('examplecode', Jekyll::ExampleCodeBlock) 15 | -------------------------------------------------------------------------------- /Source/Docs/_plugins/requiredcode.rb: -------------------------------------------------------------------------------- 1 | module Jekyll 2 | class RequiredCodeBlock < Liquid::Block 3 | def render(context) 4 | end 5 | end 6 | end 7 | Liquid::Template.register_tag('requiredcode', Jekyll::RequiredCodeBlock) 8 | 9 | -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-0.1.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-0.1.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-0.1.1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-0.1.1.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-0.1.2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-0.1.2.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-0.1.3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-0.1.3.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-0.9.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-0.9.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-0.9.5.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-0.9.5.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.0.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.0.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.1.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.1.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.2.0.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.2.0.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.2.1.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.2.1.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.3.0.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.3.0.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.4.0.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.4.0.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.4.1.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.4.1.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.4.2.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.4.2.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.4.3.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.4.3.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.5.0.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.5.0.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.6.0.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.6.0.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.6.1.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.6.1.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.7.0.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.7.0.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.7.1.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.7.1.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute-1.7.2.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute-1.7.2.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute.1.10.0.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute.1.10.0.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute.1.8.0.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute.1.8.0.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute.1.8.1.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute.1.8.1.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute.1.8.2.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute.1.8.2.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute.1.9.0.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute.1.9.0.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute.1.9.1.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute.1.9.1.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute.1.9.2.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute.1.9.2.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute.2.0.0.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute.2.0.0.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute.2.0.1.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute.2.0.1.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute.2.0.2.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute.2.0.2.0.zip -------------------------------------------------------------------------------- /Source/Docs/downloads/NSubstitute.2.0.3.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/downloads/NSubstitute.2.0.3.0.zip -------------------------------------------------------------------------------- /Source/Docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/favicon.ico -------------------------------------------------------------------------------- /Source/Docs/help.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: post 3 | title: Docs and getting help 4 | --- 5 | 6 |

Read Getting started for a quick tour of NSubstitute.

7 | 8 |

For more in depth information start with Creating a substitute.

9 | 10 |

If you can't find the answer you're looking for, head on over to the NSubstitute discussion group.

11 | -------------------------------------------------------------------------------- /Source/Docs/help/_posts/2010-02-03-return-for-any-args.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: Return for any args 3 | layout: post 4 | --- 5 | 6 | {% requiredcode %} 7 | public interface ICalculator { 8 | int Add(int a, int b); 9 | string Mode { get; set; } 10 | } 11 | ICalculator calculator; 12 | [SetUp] public void SetUp() { calculator = Substitute.For(); } 13 | {% endrequiredcode %} 14 | 15 | A call can be configured to return a value regardless of the arguments passed using the `ReturnsForAnyArgs()` extension method. 16 | 17 | {% examplecode csharp %} 18 | calculator.Add(1, 2).ReturnsForAnyArgs(100); 19 | Assert.AreEqual(calculator.Add(1, 2), 100); 20 | Assert.AreEqual(calculator.Add(-7, 15), 100); 21 | {% endexamplecode %} 22 | 23 | The same behaviour can also be achieved using [argument matchers](/help/argument-matchers): it is simply a shortcut for replacing each argument with `Arg.Any()`. 24 | 25 | `ReturnsForAnyArgs()` has the same overloads as `Returns()`, so you can also specify multiple return values or calculated return values using this approach. 26 | -------------------------------------------------------------------------------- /Source/Docs/help/_posts/2010-02-10-replacing-return-values.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: Replacing return values 3 | layout: post 4 | --- 5 | 6 | The return value for a method or property can be set as many times as required. Only the most recently set value will be returned. 7 | 8 | {% examplecode csharp %} 9 | calculator.Mode.Returns("DEC,HEX,OCT"); 10 | calculator.Mode.Returns(x => "???"); 11 | calculator.Mode.Returns("HEX"); 12 | calculator.Mode.Returns("BIN"); 13 | Assert.AreEqual(calculator.Mode, "BIN"); 14 | {% endexamplecode %} 15 | 16 | {% requiredcode %} 17 | public interface ICalculator { string Mode { get; set; } } 18 | 19 | ICalculator calculator; 20 | [SetUp] 21 | public void SetUp() { 22 | calculator = Substitute.For(); 23 | } 24 | {% endrequiredcode %} 25 | 26 | -------------------------------------------------------------------------------- /Source/Docs/help/_posts/2010-05-02-throwing-exceptions.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: Throwing exceptions 3 | layout: post 4 | --- 5 | 6 | [Callbacks](/help/callbacks) can be used to throw exceptions when a member is called. 7 | 8 | {% requiredcode %} 9 | public interface ICalculator { int Add(int a, int b); } 10 | ICalculator calculator; 11 | [SetUp] public void SetUp() { calculator = Substitute.For(); } 12 | {% endrequiredcode %} 13 | 14 | {% examplecode csharp %} 15 | //For non-voids: 16 | calculator.Add(-1, -1).Returns(x => { throw new Exception(); }); 17 | 18 | //For voids and non-voids: 19 | calculator 20 | .When(x => x.Add(-2, -2)) 21 | .Do(x => { throw new Exception(); }); 22 | 23 | //Both calls will now throw. 24 | Assert.Throws(() => calculator.Add(-1, -1)); 25 | Assert.Throws(() => calculator.Add(-2, -2)); 26 | {% endexamplecode %} 27 | 28 | -------------------------------------------------------------------------------- /Source/Docs/help/_posts/2010-11-01-setting-out-and-ref-arguments.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: Setting out and ref args 3 | layout: post 4 | --- 5 | 6 | `Out` and `ref` arguments can be set using a [`Returns()` callback](/help/return-from-function), or using [`When..Do`](/help/callbacks). 7 | 8 | {% examplecode csharp %} 9 | public interface ILookup { 10 | bool TryLookup(string key, out string value); 11 | } 12 | {% endexamplecode %} 13 | 14 | For the interface above we can configure the return value and set the output of the second argument like this: 15 | 16 | {% examplecode csharp %} 17 | //Arrange 18 | var value = ""; 19 | var lookup = Substitute.For(); 20 | lookup 21 | .TryLookup("hello", out value) 22 | .Returns(x => { 23 | x[1] = "world!"; 24 | return true; 25 | }); 26 | 27 | //Act 28 | var result = lookup.TryLookup("hello", out value); 29 | 30 | //Assert 31 | Assert.True(result); 32 | Assert.AreEqual(value, "world!"); 33 | {% endexamplecode %} 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Source/Docs/help/_posts/2013-04-01-threading.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: Threading 3 | layout: post 4 | --- 5 | 6 | It is fairly standard for production code to call a substitute from multiple threads, but we should avoid having our test code configure or assert on a substitute while it is also be used from other threads in production code. See [Issue #256](https://github.com/nsubstitute/NSubstitute/issues/256) for an example of how doing this can result in problems. 7 | 8 | To avoid this sort of problem, make sure your test has finished configuring its substitutes before exercising the production code, then make sure the production code has completed before your test asserts on `Received()` calls. 9 | 10 | -------------------------------------------------------------------------------- /Source/Docs/images/NSubstitute.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/images/NSubstitute.ai -------------------------------------------------------------------------------- /Source/Docs/images/github-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/images/github-16x16.png -------------------------------------------------------------------------------- /Source/Docs/images/nsubstitute-100x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/images/nsubstitute-100x100.png -------------------------------------------------------------------------------- /Source/Docs/images/nsubstitute-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/images/nsubstitute-16x16.png -------------------------------------------------------------------------------- /Source/Docs/images/nsubstitute-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/images/nsubstitute-32x32.png -------------------------------------------------------------------------------- /Source/Docs/images/nuget-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/images/nuget-16x16.png -------------------------------------------------------------------------------- /Source/Docs/images/teamcity-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/images/teamcity-16x16.png -------------------------------------------------------------------------------- /Source/Docs/images/teamcity-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NSubstitute/d4be72c6f789941a9ef3422f3a4e4142df9ca1c9/Source/Docs/images/teamcity-32x32.png -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/EventChecking.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NSubstitute.Exceptions; 3 | using NUnit.Framework; 4 | 5 | namespace NSubstitute.Acceptance.Specs 6 | { 7 | public class EventChecking 8 | { 9 | [Test] 10 | public void Check_if_event_was_subscribed_to() 11 | { 12 | var engine = Substitute.For(); 13 | Action handler = () => { }; 14 | Action someOtherHandler = () => { }; 15 | engine.Started += handler; 16 | engine.Received().Started += handler; 17 | Assert.Throws(() => engine.Received().Started += someOtherHandler); 18 | } 19 | 20 | public interface IEngine 21 | { 22 | event Action Started; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/FieldReports/DisposeWithThreadLocal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | 4 | namespace NSubstitute.Acceptance.Specs.FieldReports 5 | { 6 | public class DisposeWithThreadLocal 7 | { 8 | [Test] 9 | public void DisposeSubstituteAndPerformGC() 10 | { 11 | using (var s = Substitute.For()) { } 12 | GC.Collect(); 13 | GC.WaitForPendingFinalizers(); 14 | 15 | //Exception thrown on background thread. Can view this from output of test runner. 16 | } 17 | 18 | public class DisposableClass : IDisposable 19 | { 20 | bool disposed = false; 21 | ~DisposableClass() { Dispose(false); } 22 | public virtual void Dispose() { Dispose(true); } 23 | protected virtual void Dispose(bool disposing) 24 | { 25 | if (!disposed) { if (disposing) { disposed = true; } } 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/FieldReports/EqualsBehaviourOnClassSubs.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace NSubstitute.Acceptance.Specs.FieldReports 4 | { 5 | public class EqualsBehaviourOnClassSubs 6 | { 7 | [Test] 8 | public void Equals_should_work_as_expected_for_class_substitutes() 9 | { 10 | var firstSub = Substitute.For(); 11 | var secondSub = Substitute.For(); 12 | 13 | Assert.AreEqual(firstSub, firstSub); 14 | Assert.AreNotEqual(firstSub, secondSub); 15 | } 16 | 17 | public class AClass { } 18 | } 19 | } -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/FieldReports/Issue110_CustomExceptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | 4 | namespace NSubstitute.Acceptance.Specs.FieldReports 5 | { 6 | public class Issue110_CustomExceptions 7 | { 8 | public class MyException : Exception { } 9 | 10 | public interface IThrow { void Throw(); } 11 | public interface IDoStuff { event Action StuffDone; } 12 | 13 | [Test] 14 | public void ThrowExceptionWithoutSerialisationConstructor() 15 | { 16 | var ithrow = Substitute.For(); 17 | var doStuff = Substitute.For(); 18 | 19 | ithrow.When(x => x.Throw()).Do(x => { throw new MyException(); }); 20 | doStuff.StuffDone += ithrow.Throw; 21 | 22 | Assert.Throws(() => doStuff.StuffDone += Raise.Event()); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/FieldReports/Issue125_MethodWithSealedClassReturnType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using NUnit.Framework; 6 | 7 | namespace NSubstitute.Acceptance.Specs.FieldReports 8 | { 9 | public class Issue125_MethodWithSealedClassReturnType 10 | { 11 | public sealed class SealedClass { } 12 | 13 | public interface IInterface 14 | { 15 | SealedClass MethodWithSealedClassReturnType(); 16 | } 17 | 18 | [Test] 19 | public void MethodWithSealedClassReturnTypeReturnsCorrectResult() 20 | { 21 | var substitute = Substitute.For(); 22 | var expected = new SealedClass(); 23 | substitute.MethodWithSealedClassReturnType().Returns(expected); 24 | 25 | var result = substitute.MethodWithSealedClassReturnType(); 26 | 27 | Assert.That(result, Is.EqualTo(expected)); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/FieldReports/Issue170_MultidimensionalArray.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace NSubstitute.Acceptance.Specs.FieldReports 4 | { 5 | public class Issue170_MultidimensionalArray 6 | { 7 | public interface ITest 8 | { 9 | bool[,] Method(); 10 | } 11 | 12 | [Test] 13 | public void Method_Works() 14 | { 15 | var test = Substitute.For(); 16 | test.Method(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/FieldReports/Issue271_DelegateOutArgument.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace NSubstitute.Acceptance.Specs.FieldReports 4 | { 5 | public class Issue271_DelegateOutArgument 6 | { 7 | public delegate void Foo(out int bar); 8 | 9 | [Test] 10 | public void DelegateReturnsOutParameter() 11 | { 12 | var foo = Substitute.For(); 13 | int bar; 14 | foo.When(x => x(out bar)).Do(x => { x[0] = 42; }); 15 | 16 | foo(out bar); 17 | 18 | #if NET4 || NET45 19 | Assert.AreEqual(42, bar); 20 | #else 21 | Assert.Ignore("Not supported for NET35"); 22 | #endif 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/FieldReports/Issue282_MultipleReturnValuesParallelism.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using NUnit.Framework; 3 | 4 | namespace NSubstitute.Acceptance.Specs.FieldReports 5 | { 6 | [TestFixture] 7 | public class Issue282_MultipleReturnValuesParallelism 8 | { 9 | public interface IFoo 10 | { 11 | string Foo(); 12 | } 13 | 14 | #if NET45 15 | [Test] 16 | public void ReturnsMultipleValuesInParallel() 17 | { 18 | var ret1 = "One"; 19 | var ret2 = "Two"; 20 | 21 | var substitute = Substitute.For(); 22 | substitute.Foo().Returns(ret1, ret2); 23 | 24 | var runningTask1 = Task.Run(() => substitute.Foo()); 25 | var runningTask2 = Task.Run(() => substitute.Foo()); 26 | 27 | var results = Task.WhenAll(runningTask1, runningTask2).Result; 28 | 29 | Assert.Contains(ret1, results); 30 | Assert.Contains(ret2, results); 31 | } 32 | #endif 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/FieldReports/Issue33_RaisingINotifyPropertyChangedEvents.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using NUnit.Framework; 3 | 4 | namespace NSubstitute.Acceptance.Specs.FieldReports 5 | { 6 | public class Issue33_RaisingINotifyPropertyChangedEvents 7 | { 8 | [Test] 9 | public void Should_be_able_to_raise_event() 10 | { 11 | var sub = Substitute.For(); 12 | bool wasCalled = false; 13 | sub.PropertyChanged += (sender, args) => wasCalled = true; 14 | 15 | sub.PropertyChanged += Raise.Event(this, new PropertyChangedEventArgs("test")); 16 | 17 | Assert.That(wasCalled); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/FieldReports/Issue38_SettingNullReturnValue.cs: -------------------------------------------------------------------------------- 1 | using NSubstitute.Exceptions; 2 | using NUnit.Framework; 3 | 4 | namespace NSubstitute.Acceptance.Specs.FieldReports 5 | { 6 | public class Issue38_SettingNullReturnValue 7 | { 8 | public interface IDoSomething 9 | { 10 | object Something(); 11 | int SomethingWithValueType(); 12 | } 13 | 14 | [Test] 15 | public void CanSetCallToReturnNull() 16 | { 17 | var doSomething = Substitute.For(); 18 | doSomething.Something().Returns(null); 19 | var result = doSomething.Something(); 20 | Assert.That(result, Is.Null); 21 | } 22 | 23 | [Test] 24 | public void SettingCallWhichReturnsAValueTypeToNullShouldThrow() 25 | { 26 | var doSomething = Substitute.For(); 27 | Assert.That(() => doSomething.SomethingWithValueType().Returns(null), Throws.TypeOf()); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/FieldReports/Issue45_CallInfoArgAccessFailsForNull.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace NSubstitute.Acceptance.Specs.FieldReports 4 | { 5 | public class Issue45_CallInfoArgAccessFailsForNull 6 | { 7 | public interface IAmAnInterface 8 | { 9 | bool ThatHasAMethodWithArgs(string s, object o); 10 | } 11 | 12 | [Test] 13 | public void Should_be_able_to_find_a_null_arg_by_type() 14 | { 15 | string stringArgumentUsed = ""; 16 | 17 | var sub = Substitute.For(); 18 | sub.ThatHasAMethodWithArgs(null, null) 19 | .ReturnsForAnyArgs(x => { stringArgumentUsed = x.Arg(); return true; }); 20 | 21 | sub.ThatHasAMethodWithArgs(null, 42); 22 | 23 | Assert.That(stringArgumentUsed, Is.Null); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/FieldReports/Issue47_RaisingEventsWithNullArg.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | 4 | namespace NSubstitute.Acceptance.Specs.FieldReports 5 | { 6 | public class Issue47_RaisingEventsWithNullArg 7 | { 8 | public delegate void ProgressEventHandler(int progress, string message); 9 | public delegate void EventLikeHandler(object sender, EventArgs args); 10 | public interface IFoo 11 | { 12 | event ProgressEventHandler OnProgress; 13 | event EventLikeHandler OnEventishThing; 14 | } 15 | 16 | [Test] 17 | public void Pass_null_when_raising_delegate_event() 18 | { 19 | var sub = Substitute.For(); 20 | sub.OnProgress += Raise.Event(1, null); 21 | } 22 | 23 | [Test] 24 | public void Pass_null_when_raising_eventhandlerish_event() 25 | { 26 | var sub = Substitute.For(); 27 | sub.OnEventishThing += Raise.Event(new object[] {null}); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/FieldReports/Issue61_ArgAnyStringRegression.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace NSubstitute.Acceptance.Specs.FieldReports 4 | { 5 | public class ArgAnyStringRegression 6 | { 7 | public interface IFoo { string Bar(string a, double b); } 8 | 9 | [Test] 10 | public void Stub_any_string_and_call_with_null() 11 | { 12 | var foo = Substitute.For(); 13 | foo.Bar(Arg.Any(), Arg.Any()).ReturnsForAnyArgs("hello"); 14 | 15 | Assert.AreEqual("hello", foo.Bar(null, 0)); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/FieldReports/Issue83_MethodsWithGenericStructConstraint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | 4 | namespace NSubstitute.Acceptance.Specs.FieldReports 5 | { 6 | public class Issue83_MethodsWithGenericStructConstraint 7 | { 8 | public interface IService { T Get(T arg) where T : struct; } 9 | 10 | [Test] 11 | public void TestGenericCalls() 12 | { 13 | var id = Guid.NewGuid(); 14 | var service = Substitute.For(); 15 | service.Get(id); 16 | service.Received().Get(id); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Source/NSubstitute.Acceptance.Specs/FieldReports/Issue_RaiseEventOnNonSubstitute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NSubstitute.Exceptions; 3 | using NUnit.Framework; 4 | 5 | namespace NSubstitute.Acceptance.Specs.FieldReports 6 | { 7 | public class Issue_RaiseEventOnNonSubstitute 8 | { 9 | public class Button 10 | { 11 | public virtual event EventHandler Clicked = (s,e) => { }; 12 | } 13 | 14 | public interface IController { void Load(); } 15 | 16 | [Test] 17 | public void RaiseEventOnNonSub() 18 | { 19 | var notASub = new Button(); 20 | notASub.Clicked += Raise.Event(); 21 | var sub = Substitute.For(); 22 | // Next call to a substitute will fail as it will attempt to raise an event 23 | Assert.Throws(() => 24 | sub.Load() 25 | ); 26 | } 27 | 28 | [Test] 29 | public void RaiseEventOnSub() 30 | { 31 | var clicked = false; 32 | var sub = Substitute.For