chevron-thin-right
chevron-thin-left
brand
cancel-circle
search
youtube-icon
google-plus-icon
linkedin-icon
facebook-icon
twitter-icon
toolbox
download
check
linkedin
phone
twitter-old
google-plus
facebook
profile-male
chat
calendar
profile-male
Products
Isolator for C++
Isolate ++
Isolator for .NET
Suggest
Isolate
Smart Runner
Coverage – Part of Typemock Isolator Complete .NET
Isolator for Build Server
Download
C++
.NET
Pricing
Resources
Documentation
Isolator++
Isolator
Learning Center
Tutorials
Webinars
Articles
Case Studies
Partners
Blog
Support
C++ Community
.NET Community
Premium Support
Products
Isolator for C++
Isolate ++
Isolator for .NET
Suggest
Isolate
Smart Runner
Coverage – Part of Typemock Isolator Complete .NET
Isolator for Build Server
Download
C++
.NET
Pricing
Resources
Documentation
Isolator++
Isolator
Learning Center
Tutorials
Webinars
Articles
Case Studies
Partners
Blog
Support
C++ Community
.NET Community
Premium Support
Menu
Search
Remember
Register
Typemock Q&A
Ask a question
All Activity
Questions
Hot!
Unanswered
Tags
Users
Ask a Question
The Unit Testing Company
Development Resources
Knowledge Base
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
Related questions
Why possible to stub DateTime.Now but not DateTime.Today?
Mocking DateTime.Now with 5.3.5
Typemock 5.3.1: WasNotCalled Not Working with DateTime.Now
Typemock 5.3.1: Exception when debugging a test
MockObject: Exception when mocking a struct
Exception when stub DateTime.Now from inside a DoInstead()
0
votes
Stubbing DateTime.Now from inside a DoInstead() throws an exception:
[ img ]
Code for the above:
http://pastebay.com/pastebay.php?dl=77555
asked
Dec 19, 2009
by
Neil
Report User
(
27.7k
points)
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
2
Answers
0
votes
Hi Neil,
This issue is caused due to the behavior set inside the
DoInstead
block. Setting faked behavior inside
DoInstead
is no supported and it causes this exception.
Regards,
Elisha,
Typemock Support
answered
Dec 20, 2009
by
Elisha
Report User
(
12k
points)
Please
log in
or
register
to add a comment.
0
votes
Thanks Elisha. Could a message be added to the exception to say not supported?
To work around this I will refactor my now-dependent method and the method that calls my now-dependent method so I can stub DateTime.Now outside of a DoInstead.
answered
Dec 20, 2009
by
Neil
Report User
(
27.7k
points)
Please
log in
or
register
to add a comment.
...
×
Choose the product type:
WINDOWS
LINUX DEB
LINUX RMP
×