Home Products Download Learn Buy Now Why Typemock? Support & Community About
Community > Forum
 FAQFAQ    SearchSearch   RegisterRegister   RssRss   ProfileProfile   Log inLog in 

will mocking mscorlib types ever be supported?

 
Post new topic   Reply to topic    Typemock Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
servotest bob
Advanced
Advanced


Joined: 07 Oct 2005
Posts: 17

PostPosted: Tue Apr 04, 2006 10:30 am    Post subject: will mocking mscorlib types ever be supported? Reply with quote

will mocking mscorlib types ever be supported?
Back to top
View user's profile Send private message
scott
Moderator
Moderator


Joined: 09 Jan 2005
Posts: 735

PostPosted: Tue Apr 04, 2006 12:45 pm    Post subject: Reply with quote

Hi,
It will be supported, but not in the next release that is due next week.
_________________
Regards

Scott,
TypeMock Support Group
Back to top
View user's profile Send private message
stephan
Newbie
Newbie


Joined: 30 May 2006
Posts: 3

PostPosted: Tue May 30, 2006 8:37 am    Post subject: Reply with quote

Hi,
Can you be more precise. When to expect mocking mscorlib types?
Back to top
View user's profile Send private message
richard
Moderator
Moderator


Joined: 09 Jan 2005
Posts: 97

PostPosted: Wed May 31, 2006 12:36 pm    Post subject: Reply with quote

Hi,
This is still in the works Smile.
What types would you like to mock, perhaps we can mock these first?
_________________
Regards

Richard,
TypeMock Support Group
Back to top
View user's profile Send private message
stephan
Newbie
Newbie


Joined: 30 May 2006
Posts: 3

PostPosted: Wed May 31, 2006 12:48 pm    Post subject: Reply with quote

Thank you for the reply Richard.

I'm trying to mock StreamWriter.

Best Regards
Stephan Zahariev
Back to top
View user's profile Send private message
richard
Moderator
Moderator


Joined: 09 Jan 2005
Posts: 97

PostPosted: Wed May 31, 2006 1:25 pm    Post subject: Reply with quote

I will add this to our list.

We used the following technique when our tests need to mock Streams.

What we did was to change the file that was being opened and we pointed to another file.

We did this by having a Property with the filename and mocking the property.
e.g. We want to see how we behave with a non existing file

Code:
private string Filename
{
    get { return theFileName; }
}

StreamWriter writer = new StreamWriter(Filename);

// in our tests
mock.ExpectGet("FileName","a_file_that_doesnt_exist');

_________________
Regards

Richard,
TypeMock Support Group
Back to top
View user's profile Send private message
stephan
Newbie
Newbie


Joined: 30 May 2006
Posts: 3

PostPosted: Wed May 31, 2006 1:40 pm    Post subject: Reply with quote

Thanks for the help.

Stephan Zahariev
Back to top
View user's profile Send private message
dagilleland
Newbie
Newbie


Joined: 01 Feb 2006
Posts: 2

PostPosted: Wed Jul 05, 2006 3:41 pm    Post subject: Reply with quote

richard wrote:
Hi,
This is still in the works Smile.
What types would you like to mock, perhaps we can mock these first?

Is it possible to mock the Today property of Date or DateTime?

I've got some tests that have special circumstances for special dates (like range validating when the current date is 1/1/2006), and if I could write mocks to handle those cases, my testing would truly be complete.
Back to top
View user's profile Send private message
ohad
Site Admin
Site Admin


Joined: 18 May 2006
Posts: 683

PostPosted: Thu Jul 06, 2006 1:46 pm    Post subject: Reply with quote

Hi stephan

Unfortunately DateTime is part of the mscorlib Mad
As richard wrote mocking mscorlib is still in the works.
Don't lose your hope! Smile
_________________
Regards

Ohad,
TypeMock Support Group
Back to top
View user's profile Send private message
scott
Moderator
Moderator


Joined: 09 Jan 2005
Posts: 735

PostPosted: Thu Jul 06, 2006 6:06 pm    Post subject: Reply with quote

although DateTime.Now cannot be mocked there is a workaround.

You can define the following static property in your code.
Code:
public class DataUtils
{
   public static Now
   {
       get { return DataTime.Now; }
   }
}


This is already very easy to mock
_________________
Regards

Scott,
TypeMock Support Group
Back to top
View user's profile Send private message
kenn
Newbie
Newbie


Joined: 19 Nov 2007
Posts: 1

PostPosted: Mon Nov 19, 2007 6:49 am    Post subject: Reply with quote

Hi Scott,

But does this mean that in the code that I am testing, I will need to use the DataUtils class instead of the DateTime class? If so, that's not very desirable.

Since your post was made over a year ago, has there been a change on whether the mscorlib types be supported for mocking?

Ken
Back to top
View user's profile Send private message
lior
Moderator
Moderator


Joined: 28 Sep 2006
Posts: 305

PostPosted: Mon Nov 19, 2007 11:33 am    Post subject: Reply with quote

Ken hi,

So far there has not been any progress on this. Sad
However wse do hope to implement this in the near future.
_________________
Lior
TypeMock Support Group
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Typemock Forum Index -> Feature Requests All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group