Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

NCrunch 1.41b + TypeMock Isolator V7.1.1.0 -> Faking DateTime fails
emargee
#1 Posted : Wednesday, October 10, 2012 11:54:20 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/10/2012(UTC)
Posts: 2

Edit: Sorry, this got created in the wrong forum .. please move this if possible!

I ran into a bug using NCrunch in VS2012 with TypeMock Isolator v7.1.1.0

Code:

[Test]
public void DateReturnsCorrectly()
{
    var testDate = new DateTime(2000, 1, 1);
    Isolate.WhenCalled(() => DateTime.Now).WillReturn(testDate);
    Assert.AreEqual(testDate, DateTime.Now);
}


This test will pass when using the Resharper test runner but fail in NCrunch. I have raised a support issue with Typemock as well
but wanted to report it here just in case.

I am assuming its due to it trying to fake a mscorlib class call.

If you need any more information please let me know. If i receive any information from TypeMock I will update this thread also.
Remco
#2 Posted : Wednesday, October 10, 2012 8:11:16 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Hi, thanks for posting!

Can you share any more details about the experience you have when the test fails in NCrunch? i.e. does it throw a runtime exception when it reaches the Isolate call, or does it simply behave as though the date hasn't been stubbed?

One way you can check whether the NCrunch integration with TypeMock is working correctly is by examining the list of running processes on your computer while NCrunch is executing the test. If you see a process called 'TMockRunner.exe' then this means that NCrunch is running the tests via TypeMock integration (which is the correct behaviour).


Cheers,

Remco
emargee
#3 Posted : Friday, October 12, 2012 3:38:55 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/10/2012(UTC)
Posts: 2

Hi Remco, thanks for getting back to me ..

The exception is a TypMock one :

Code:

SetUp : TypeMock.TypeMockException : 
*** No method calls found in recording block. Please check:
 * Are you trying to fake a field instead of a property?
 * Are you are trying to fake an unsupported mscorlib type? See supported types here: http://www.typemock.com/mscorlib-types
   at gj.a(cx A_0, Boolean A_1)
   at bh.a(Boolean A_0)
   at dl.b(Boolean A_0)
   at ik.b(Boolean A_0)
   at ik.a(Object A_0, Boolean A_1, Func`1 A_2, Action A_3, Action A_4, Action A_5, Boolean A_6)
   at ik.e(Object A_0)
   at TypeMock.ArrangeActAssert.ExpectationEngine`1.a(TResult A_0)


.. looking at the processes I can see two TMockRunner.exe processes .. hanging about not doing anything (should they close when done ?)

If you need any extra logs let me know. I was kind of hoping I would have heard back from TypeMock support about this by now and would have something better to share :/
Remco
#4 Posted : Friday, October 12, 2012 11:41:53 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
This issue seems as though it may be similar to an earlier reported issue related to TypeMock Isolator V7: http://forum.ncrunch.net...g-with-isolator-V7.aspx

The residence of the TMockRunner.exe processes indicates that NCrunch is correctly loading the Isolator profiler into the task runner, so most likely the is something happening within the profiler that is causing it to fail in the environment.

Unfortunately the Isolator profiler is very much a black box to NCrunch (and myself), so there's no way for me to help you with identifying the true source of the problem. Earlier versions of Isolator V7 did have reported problems with NCrunch, although these were confirmed to be fixed in a recent release. It may be that the build of Isolator you are using has a regression, or that the environment you're working in is somehow surfacing a different issue.

Something to try could be to downgrade to the version of Isolator V7 which was confirmed to be working with NCrunch. This would help to confirm whether the issue is caused by a regression or whether it's something in your environment.
stephenpope
#5 Posted : Monday, February 18, 2013 3:19:35 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/20/2012(UTC)
Posts: 7
Location: United Kingdom

Was thanked: 2 time(s) in 2 post(s)
I have been working with TypeMock support on this one and have now found a solution ! (yay!)

Thought I would post here in case anyone is having any other issues ..

1. Close all VS instances
2. Go to The TypeMock install directory and locate 'namespaces.dat'
3. In there add 'nCrunch.TaskRunner.dll' at the bottom
4. Reload VS and your tests

Apparently this will be fixed in their latest version coming out next week but if anyone is stuck using a slightly older version (i was using 7.2) then try this out.

1 user thanked stephenpope for this useful post.
Remco on 2/18/2013(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.040 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download