fakeiteasy


How to fake delegates with FakeItEasy


When i try to fake a delegate-type, i get System.InvalidCastException
[TestMethod]
public void TestDelegateFake()
{
var func = A.Fake<Func<long, object>>();
A.CallTo(() => func(A<long>.Ignored))
.Returns(new {});
func(123);
}
How du i fake delegates?
I think you have to specify the Invoke-method explicitly:
A.CallTo(() => func.Invoke(A<long>.Ignored)).Returns(new {});

Related Links

Converting an MOQ property setup to FakeItEasy
Howto loop OrderedAssertions in FakeItEasy 2
FakeItEasy setting property with no get accessor?
FakeItEasy mocked method won't return object, instead nullReferenceException
How to specify the class to use when faking a property?
How can I fake a Class used insite SUT using FakeItEasy
FakeItEasy expectation fail against HashSet comparisons
FakeItEasy AssignsOutAndRefParameters - lazily?
How do I find the underlying Type of a Fake object returned from FakeItEasy?
FakeItEasy ReturnsLazily with out parameter
how to verify that a method was called with an argument of a specific type
How to fake delegates with FakeItEasy
FakeItEasy & “params” arguments
Using Expression Trees as an argument constraint
How to update a property on a parameter using FakeItEasy

Categories

HOME
elm
yarn
angular-ui-bootstrap
indesign
django-imagekit
slick-slider
reveal.js
spring-xd
u-sql
apache-cayenne
visual-studio-2005
crystal-reports-2008
kvc
format-specifiers
rundeck
pepper
brunch
tooltipster
entitlements
delicious-api
nouislider
media-queries
stormpath
junit5
siesta-swift
lxd
windows-dev-center
gammu
mapbox-gl
plsql-psp
hot-module-replacement
dism
unoconv
eclipse-scout
avro4s
dynamic-reports
xml-documentation
jedis
qsslsocket
aurelia-validation
darcs
namecoin
color-picker
url-masking
autorest
storekit
skype4py
srand
prerequisites
spidermonkey
tableau-online
microbenchmark
streambase
npapi
rake-task
tween
socketexception
xcode-6.2
gulp-less
datagridviewcolumn
didselectrowatindexpath
prettify
page-layout
gridfs
opcache
excel-2003
cassini-dev
unc
gdata-api
armcc
gcj
joyent
web-architecture
virtual-functions
yagni
spec#
zune
genealogy
dbisam

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App