NET35 doesn't seem to support Expression.Variable.
Added back previous DelegateProxyFactory implementation from
ac140ef7ba for NET35 target only.
Updated test accordingingly.
- Replaced InvalidOperationException with new SubstituteInternalException
in CallCollection. Asks people to submit error to GH issues as we don't
expect this case can happen.
- Added a fold/Handle method to PendingSpecificationInfo so we don't
have to check each case for `null` (basically: Either<ICallSpec, ICall>).
Rename ICallStack to ICallCollection. That is because the Pop()
method is not required more (and was deleted), and Delete()
method was added instead. That is much more collection that stack.
IPendingSpecification now holds both information about previous
call and pending specification. That is encapsulated to the
PendingSpecificationInfo. The reasons why I added one more
responsibility to this class are following:
- We always either use pending specification or information about
previous call. This data is mutually exclusive (we delete other
one when store current one). Therefore, I decided that information
about previous call is also a specification to some degree.
- It's simpler to track sources of specifications because now we
have a single place only. In my previous implementation we needed
to clear pending specification and information about last call - more
chances to fail somewhere.
- Data is stored in SubstitutionContext, so we have single field
instead of two (one for pending specification, second for last
call information).
PendingSpecificationInfo stores thread-local on SubstitutionContext
(i.e. per substitute).
GetCallSpec now uses IPendingSpecification only to resolve
specification. Therefore, I renamed the FromLastCall method
to the FromPendingSpecification because it better reflects the
method implementation.
TrackLastCallHandler introduced to set `IPendingSpecification`.
More precise set of changes:
- Ensure that specification evaluates original argument values,
because they could be modified during call dispatch.
- Ensure that original arguments are used to check whether
current call meets particular specification.
- Use own results cache for AutoValues route handler.
That is needed to ensure that AutoValues priority isn't increased.
Otherwise, once handler invoked for the first time,
it's "memory" will have same priority as user configured results.
As outcome, custom handlers, returns for type, etc will not be invoked.
Building dotnet core package with dependency on beta of Castle.Core errors
out with:
A stable release of a package should not have on a prerelease dependency.
Either modify the version spec of dependency
"Castle.Core [4.0.0-beta001, )" or update the version field.
Providing some basic support for alpha/beta/rc tags to work around this.
(Really need a better versioning/release procedure one of these days.)
* Remove original NSubstitute project
* Add dotnet core project
* Remove unnecessary meta info
* Add Castle.Core as dependency
* Move dependencies under dontnet core framework
* Upgrade packages versions
* Add TypeExtensions based on AutoMapper code
* TypeExtensions used
* Solve some reflection issues
* Solve SerializationInfo and StreamingContext issues
* Add Collections.Concurrent package
* Seems custom dll worked
* Add System.ServiceModel assembly
* ConvertAll fix
* Remove System.ServiceModel from Net Core
* Remove System.Security.Permissions from Net Core
* Adjust TypeExtensions class
* Not DNXCORE50 condition replaced with NET4 || NET45
* Add FAKEX package to build DNX projects
* Add bat script that installs dnvm and the latest runtime
* Add draft DNX specific targets
* Remove FAKEX tools
* Add NSubstitute.NET project based on original project file to be able to test the code
* Add TypeExtensions
* Define NET35 condition constant
* Copy ilmerge.exclude
* Tests projects are back ☺️
* Fixed exception serialization for NET35
* Security and Serialization for NET35
* Finish resolving conflicts
* Port changes from "main" csproj file
* Update to the latest coreclr version
* Hardcode VS version. MSBuild I love you soooo much!!! 🐮🐮🐮
* Update Runtime
* Remove unused csproj
* Exclude project.lock file
* Ignore project lock
* No Serializable in .NET Core
* Move .NET Core project to a separate solution file
* Resolve merge conflicts
* Change CoreCLR version to "stable" one
* No restore stage
* Remove not used csproj
* Build only
* Add Merge task
* Add a file from the previous merge to the new .NET proj file
* Add Castle.Core alpha version
* Disable AutoQueryableProvider so far
* Remove dll wrapper. It's not needed any more
* Bump version to 2.0.0-alpha. Add package details.
* Enable Task extensions for .NET Core
* AutoTaskProvider is there for .NET Core 🎉
* Enable AutoObservableProvider for beloved .NET Core
* AutoQueryableProvider it is. Build works from Visual Studio but not from CLI. MS, I love you sooo f* much.
* No more dnx and dnvm. Long live dotnet cli. Please 🙏🙏🙏
* Dynamics in Core
* Bump the version
* Add a runner for the unit tests
* Add the Acceptance tests proj to .NET Core
* Fixing the build of the acceptance tests proj
* Better runner
* Yeah, the System.Diagnostics.TraceSource thing, of course
* Fix IsSubclassOf for .NET 🐮
* Fix dynamics for .NET Core
* Enable some tests for .NET Core
* Enable tests for .NET Core
* Bump the version to alpha003 💥
* Test runner
* Misc. fixes
* Fix reflection extensions
* Fixing the .NET 4 build
* Fix the .NET 3.5 build
* Build netstandard1.5 only
* Fix namespace
* No reason in Configuration. They handled via project.json
* Fix the build
* Revert the new API asserts
* Remove not needed file from .NET Core proj
* Remove Program.cs and emitEntryPoint from test app
* Fix test: new line char for unix
* Fix the leftover conditional
* Passes on both Windows and Ubuntu
* Add CI scripts
* Bump the version to beta
* Respond to Castle's NetCore port.
Now we don't need to import anything and have pure netcore project.
Also fixed the issue introduced by gh-238, i.e.
`ExpectedExceptionAttribute` does not exists anymore in
`NUnit.Framework`, so I wrapped it in a `Assert.Throws<Exception>`.
* Fix artifacts path in appveyor script
* FAKE build script for .NET Core
* Add a separate csproj for .NET 4 tests because they don't play well with .NET Core. For more details see: https://github.com/dotnet/corefx/issues/4544#issuecomment-230272419
* Update FAKE. Sorry...
* Install FAKE.Dotnet
* Fixes for .NET Core artifacts
* XML docs for .NET Core
* Update NuGet
* Explicit dependencies for .NET Core
* Dependencies appear in nuspec
* Update min versions
* .gitignore VS and FAKE files
* Clean up
* Added netstandard1.5 target to build
- Added netstandard1.5 as valid target
- Skipped NETCORE_TARGETS for tasks that are currently incompatible
(such as tests/tests against docs)
- Documented build params in "-T" task
- Hacked around with FAKE target dependencies to try to selectively build
NET/dotnetcore projects based on targets. Had to add "soft dependencies"
on Clean and Version to make sure that, if they are being run, they do
so prior to build. See [1].
[1]: http://fsharp.github.io/FAKE/soft-dependencies.html
* Fixing nuspec data
Moved clear to an extension to prevent bloating global intellisense.
Can add it back to main SubstituteExtensions if required later on.
Can opt-in to this with `using NSubstitute.ClearExtensions;`.
Applying suggestions from @alexandrnikitin (#179):
- Renamed ClearSubstitutions to ClearSubstitute
- Made ClearOptions.All the default
- Replaced tabs with spaces for consistency
- Renamed ClearanceFlags to ClearOptions
- CallResults.Clear cheats and creates a new queue rather than dequeuing
each item.
- Moved flags check from SubstituteExtensions to CallRouter.
- Clearing configured results also clears ResultsForType (configured
via ReturnsForAll<T>)
- Not obsoleting ClearReceivedCalls yet as it will be a breaking change
if warnings-as-errors is on.
- Refactoring: CallRouter used to cache some bits of substitute state.
Changed it to go direct to substitute state in case that value changes
for some reason.