Hi
I don't know, is it your bug or Microsoft, but I decided to start from you. Sorry :)
I have a strange error in VS 2012 only (in VS 2010 all works fine).
I need to mock the following thing:
using (RecordExpectations recorder = RecorderManager.StartRecording())
{
recorder.ExpectAndReturn(System.Configuration.ConfigurationManager.AppSettings.Get(""), "0");
}
A get an exception on line with "recorder.ExpectAndReturn(...);":
Test method TestExample.UnitTests.UnitTest1.TestSumMethod threw exception:
TypeMock.TypeMockException:
*** Cannot use Return in this sequence, there must be a mocked statement first
Perhaps you are trying to mock a method from an unsupported mscorlib type. See supported types here:
https://www.typemock.com/mscorlib-types
Result StackTrace:
at TypeMock.RecordExpectations.b(String A_0)
at TypeMock.RecordExpectations.a(String A_0)
at TypeMock.RecordExpectations.Return(Object returnValue)
at TypeMock.RecordExpectations.ExpectAndReturn(Object mockedStatements, Object returnValue)
at TestExample.UnitTests.UnitTest1.TestSumMethod() in d:ProgiWork_TestTestExampleTestExample.UnitTestsUnitTest1.cs:line 15
The error appears only if a testsetting (testrunconfig) file is specified in Test->Test Settigns.
My OS is x64, so I check "X64" in Test->Test Settings->Default Processor Architecture.
I have created a small example: just one class with one method, one unit test project with one test and 3 lines. It works, if no testsettings files are specified and stop working, if you specify a testsettings file (and rebuild). I used a default test settigns file and our old testsettings file with the same result.
Do you know, who is guilty and what should I do?
P.S. I have attached my test example, if you don't want to create it by yourself.
P.P.S. I tests it on Typemock v. 7.4.
TestExample.zip