I recently purchased TypeMock and the TypeMock
examples seem to run fine. However, since yesterday, I have been unable to get even the simplest TypeMock test to run (although, inexplicably, the TypeMock examples continue to run just fine).
I am mocking my own simple class, not framework ones. I get the same error running the test from VS2005 and TMockRunner. To be honest, I feel like I am going mad, very quickly. I assume that I
must be making a rookie mistake, I just can't see where.
XP Pro SP2, Dual CPU, Dual monitor, 3Gb RAM. VS 2005 Pro SP1, R# 2.5.1.
So, from scratch:
- I create a new C# class library project using VS2005 Pro SP1 (with R# 2.5.1)
- I add references to nunit (2.2.8) and TypeMock (3.6.1 Enterprise)
- I add two classes, the tester and the testee. Both very simple and reproduced below
- I run the tests from VS2005 (TypeMock.NET is enabled) using either TestRunner or R# Test tool OR I run the test using TMockRunner.exe, as shown below
I have tried rebooting, unitstalling and reinstalling TypeMock. All to no avail.
TMockRunner output with Error
C:DevTypeMockBrandNewTestTypeMockBrandNewTestinDebug>"c:Program FilesTypeMockTypeMock.NETTMockRunner.exe" "c:Program FilesNUnit-Net-2.0 2.2.8in
unit-console.exe" TypeMockBrandNewTest.dll
NUnit version 2.2.8
Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole.
Copyright (C) 2000-2003 Philip Craig.
All Rights Reserved.
OS Version: Microsoft Windows NT 5.1.2600 Service Pack 2 .NET Version: 2.0.50727.42
.F
Tests run: 1, Failures: 1, Not run: 0, Time: 0.313 seconds
Failures:
1) TypeMockBrandNewTest.Class1.RunMe : TypeMock.TypeMockException :
*** Cannot use Return in this sequence, there must be a mocked statement first
at TypeMock.RecordExpectations.b(String A_0)
at TypeMock.RecordExpectations.a(String A_0)
at TypeMock.RecordExpectations.Return(Object returnValue)
at TypeMockBrandNewTest.Class1.RunMe() in c:DevTypeMockBrandNewTestTypeMockBrandNewTestClass1.cs:line 15
Tester class
using NUnit.Framework;
using TypeMock;
namespace TypeMockBrandNewTest
{
[TestFixture] public class Class1
{
[Test] public void RunMe()
{
using (RecordExpectations recorder = new RecordExpectations())
{
Boo boo = new Boo();
boo.GetValue("foo");
recorder.Return(22); // NOTE: THIS IS LINE 15 INDICATED IN THE ERROR OUTPUT
}
Boo b = new Boo();
Assert.AreEqual(22, b.GetValue("foo"));
}
}
}
Testee class
namespace TypeMockBrandNewTest
{
public class Boo
{
public int GetValue(string arg)
{
if (arg == "boo") return 1;
return 2;
}
}
}
I have the output from running after
set TMOCK_VERBOSE=1 but I am not sure that I can attach those files to this post.
!!!!P L E A S E H E L P!!!![/i]