Releases: FakeItEasy/FakeItEasy
2.1.0
New
- Source stepping via GitLink. (#735)
- Non-generic Fake and Dummy creation -
Sdk.Create.Fake
,Sdk.Create.Dummy
,Sdk.Create.CollectionOfFake
andSdk.Create.CollectionOfDummy
. (#482) - Add overload with options builder for
A.CollectionOfFake
. (#755) - New
WithNonVoidReturnType
method to allow configuration of the return value for any return type. (#648) - [Analyzer] Support
using static FakeItEasy.A
in unused call specifications. (#742)
Fixed
- [Analyzer] Avoiding argument null exception in
UnusedReturnValueAnalyzer
when encountering an invocation that's not a member access. (#731) - Various typos in the documentation have been corrected. (#749)
With special thanks for contributions to this release from:
- Balázs Bónis - @balazsbonis
- Maksym Vasyshchev - @mvas
- Mertsch - @Mertsch
2.0.0
This major release of FakeItEasy comes jam packed with new features, improvements and bug fixes.
Notably, a lot of work has gone into making FakeItEasy 2.0.0 thread-safe, for running tests in parallel, which is the default behavior of some of the latest versions of popular test frameworks such as xUnit.net. We're also excited about the simpler and more powerful API for configuring events. Now
and Go
are gone, and you can now raise events of any type (an often requested feature). The API as a whole has been streamlined significantly with many redundant features removed, inappropriate members hidden from Intellisense, and support for legacy platforms (.NET 3.5, Silverlight) removed. For full details of all changes in 2.0, see below.
Oh, we've also created a Roslyn Analyzer! The first diagnostic we've added warns you if you've made a call specification, e.g. A.CallTo(() => foo.Bar())
and then haven't done anything with it, e.g. .Returns(42)
. Look out for more diagnostics and code fixes to come!
We hope you enjoy using FakeItEasy 2.x as much as we've enjoyed building it!
Get the new release and the analyzer from NuGet now!
Changed
-
Raising custom event handler events now require a typeparam (but neither
Now
norGo
). (#30)
For example:public delegate void CustomEventHandler(object sender, CustomEventArgs e); … event CustomEventHandler CustomEvent; … fake.CustomEvent += Raise.With<CustomEventHandler>(fake, sampleCustomEventArgs);
To avoid this requirement, make
CustomEvent
anEventHandler<CustomEventArgs>
. -
Passing a null sender to
Raise.With
now raises an event with a null sender. UseRaise.With(TEventArgs)
to raise with the Fake as the sender. (#395) -
The old
IFakeOptionsBuilder
interface is now namedIFakeOptions
. A newIFakeOptionsBuilder
interface was created to provide implicit fake configuration at time of creation. (#520, #461) -
IFakeOptionsBuilder
replacesIFakeConfigurator
.IFakeOptionsBuilder
is more flexible, and implementations can provide implicit creation options for multiple types of fakes. The interface has changed as well, allowing any of the fake creation options to be applied implicitly. (#402, #520):Priority Priority { get; } bool CanBuildOptionsForFakeOfType(Type type); void BuildOptions(Type typeOfFake, IFakeOptions options);
-
Fakes' methods act the same during fake creation as after. They return the same results, calls to them show up in
MustHaveHappened
, and they are subject to configuration during fake construction via explicit fake creation options or implicit fake creation options. (#371) -
Fake creation option
OnFakeCreated
has been renamed toConfigureFake
to reflect that its effects are active during fake creation. (#454) -
Fake creation options now have more predictable interactions (#467):
WithAdditionalAttributes
stacks instead of overriding previous callsWrapping
overridesCallsBaseMethods
,Strict
, andConfigureFake
, on the principle of "last action in wins"
-
IDummyDefinition
andDummyDefinition<T>
have been renamed toIDummyFactory
andDummyFactory<T>
. The factories are now more powerful, able to create more Dummy types from a single factory type, as the interface has changed. (#402, #441):bool CanCreate(Type); object Create(Type); Priority Priority {get};
-
Unconfigured get properties now return a Dummy, rather than trying to make a Fake first. This matches unconfigured methods' behaviour. (#156)
-
Unconfigured methods that return
Lazy
orTask
of a non-Dummyable type now return a concreteLazy
orTask
of the default value for the parameterized type, instead of a FakeLazy
orTask
. (#560) -
Ordered assertions are made using a new API. (#637):
A.CallTo(() => unitOfWorkFactory.BeginWork()).MustHaveHappened() .Then(A.CallTo(() => usefulCollaborator.JustDoIt()).MustHaveHappened()) .Then(A.CallTo(() => unitOfWork.Dispose()).MustHaveHappened());
-
IArgumentValueFormatter
,IDummyFactory
, andIFakeOptionsBuilder
have all had theirPriority
member changed to be a new type,Priority
, which can only be constructed with values0
–255
, with a special memberPriority.Default
equivalent to a priority of0
. -
ArgumentCollection
,IRepeatSpecification
, andRaise
have moved to theFakeItEasy.Configuration
namespace. There should be no need to access these except as return values from API methods. (#432) -
The
IHideObjectMembers
API support interface was moved to theFakeItEasy
namespace. (#585)
Removed from public API
- .NET 3.5, Silverlight, Windows8, and Windows8.1 support. (#217, #507)
Now
andGo
, formerly used when raising events. (#30)Any
andConfigure
types. Also theFakeItEasy.ExtensionSyntax
namespace, which providedfake.Configure().CallsTo(…)
,
fake.CallsTo(…)
. UseA.CallTo(…)
instead. (#408, #410)- static methods
A.Equals
,A.ReferenceEquals
,Fake.Equals
,Fake.ReferenceEquals
. Use corresponding methods onobject
instead. (#425) ArgumentCollection.Empty
(and class's constructors),ITypeCatalogue
,TypeCatalogue
,FakeManager.Factory
andFakeManager
's constructor,ICallCollectionAndCallMatcherAccessor
,ICallMatcher
,ICallMatcherAccessor
,ProxyGeneratorResult
. All known uses for these were internal to the
library. (#428)IFakeObjectCallRuleWithDescription
. No known uses. (#410)ConditionalWeakTable
,InheritedExportAttribute
,ImportManyAttribute
, andTuple
classes, as well as the
Zip
andFirstFromEachKey
enumerable extension methods. These were always intended for internal use only. (#565)IFakeObjectContainer
,IFakeObjectOptionsBuilder
,DelegateFakeObjectContainer
,DynamicContainer
,NullFakeObjectContainer
, and Fake Scope creation methods that allowed the user to supply anIFakeObjectContainer
. (#603)IFakeScope
,Fake.CreateScope
. Fake Scopes are no longer supported. (#604)NextCall
is no longer supported, and has been removed. As a result,IInterceptedFakeObjectCall.DoNotRecordCall
, andIWritableFakeObjectCall
provided no value and have been removed. (#642)
Fixed
- Improved exception thrown when fake's base's constructor fails. (#367)
- Returning the same object on subsequent auto-property
get
s even when the property type is not fakeable. (#312) - No longer throwing
NullReferenceException
when trying to fake a non-virtual generic method method. (#480) - No longer attempting to load Bootstrapper from dynamic assemblies. (#561)
AssignsOutAndRefParameters
now works properly with faked delegates. (#677)
New
- Can now raise events of arbitrary delegate type. (#30)
- Dummy
Lazy<T>
values now default to having a value (which is a Dummy of typeT
). (#358) Implements
now has a generic overload:Implements<IAmAnInterface>()
. (#470)- Better threadsafety when using
That.Matches
orIgnored
argument constraints. (#476) - Better threadsafety for
ArgumentValueFormatter
. (#500) - Fakes now record and assert received calls in a threadsafe manner. ([#60...
1.25.3
- Fixed: [Out] method parameters treated like
out
parameters, so methods can't be configured - #508
Thanks to @RichardLangFromNZ for raising the issue.
1.25.2
1.25.1
1.25.0
1.24.0
1.23.0
- New: Implicit assignment of out parameters, no need for AssignsOutAndRefParameters - #220
- Fixed: Ignoring the initial value of out parameters when asserting calls - #215
- Fixed: No exception when attempting to fake an invisible internal method - #338
- Fixed: Ordered assertions fail across fake instances - #193
With special thanks for contributions to this release from:
- Igal Tabachnik - @hmemcpy
- Johan Nilsson - @Dashue
- Sean Kearney - @seankearney
- @drauch
1.22.0
- New: Provide a Lazy version of AssignOutAndRefParameters - #319
- New: Provide convenience methods for AssignsOutAndRefParametersLazily - #322
- New: Argument Constraints support derived types as Type Arguments - #326
With special thanks for contributions to this release from:
- Chris Ruttencutter - @crutt
- @FUR10N
1.21.0
- New: Default implementation of faked parameterized properties (VB.Net only) and indexer properties now work just like "regular" properties - #293, #277
- New: Better error messages when trying to override static (including extension) methods - #313
With special thanks for contributions to this release from:
- Johan Nilsson - @Dashue
- @flandersen
- @afromogli