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
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.
0 votes

We are runnng on Jenkins for our ci and msbuild.

The error that I am getting is

MESSAGE:
TypeMock.DesignModeException : 
*** Faking non-virtual methods is not possible in InterfaceOnly mode. You are in InterfaceOnly mode due to one of the following :
1. Your license has expired. Please contact Typemock sales team at sales@typemock.com.
2. You applied [Isolated(DesignMode.InterfaceOnly)] in your tests while trying to fake non-virtual methods. Learn more here https://www.typemock.com/isolator-design-mode
License details: Company VSP_1xBuildSub_T Key R8C8-XXXX-XXXX-XXXX-XXXX
+++++++++++++++++++

(I XXXX'd out most of the license on purpose.) The problem is that in my build scripts I have applied the correct company and license:

<PropertyGroup>
<TypeMockLocation>..TypemockAutoDeploy</TypeMockLocation>
<TypeMockCompany>VSP_1xBuildSub</TypeMockCompany>
<TypeMockLicense>6D47-XXXX-XXXX-XXXX-XXXX</TypeMockLicense>
</PropertyGroup>
 
... and in the build script:
 
<Import Project="$(TypeMockLocation)TypeMock.MSBuild.Tasks" />
<Target Name="RegisterTypeMock">
<Message Text="$(TypeMockLocation)TypeMock.MSBuild.Tasks" />
        <TypeMockRegister 
            Company="$(TypeMockCompany)"
            License="$(TypeMockLicense)"
            AutoDeploy="True"
        />
    </Target>
 
I went to the build server and confirmed that the two files (snippets above) are correctly in those files.
 
Where is it getting the wrong company and license from?  (As an aside, the values it IS trying to use were from temporary licenses that we received, that expired on 2/11/2017.  So they are related to us, but I am not using them in the build.)
 
I am using Nuget package for my assemblies, rather than creating hard file references.
 

UPDATE:

After looking at the testResults.xml file, it appears that some tests are passing while others are failing.  So maybe this isn't just about the license, although the license is still wrong.  

                  <test-case name="TestSuite.ServicesTest.BusinessServiceTypeMockTests.SaveOutOfOfficeReturn_ThrowsException" executed="True" result="Success" success="True" time="0.039" asserts="1" />
                  <test-case name="TestSuite.ServicesTest.BusinessServiceTypeMockTests.SavePosPatientPayment" executed="True" result="Success" success="True" time="0.068" asserts="1" />
                  <test-case name="TestSuite.ServicesTest.BusinessServiceTypeMockTests.SavePosPatientPayment_ArgumentsCorrectlyAssignedToTransaction" executed="True" result="Success" success="True" time="0.050" asserts="0" />
                  <test-case name="TestSuite.ServicesTest.BusinessServiceTypeMockTests.SavePosPatientPayment_CheckTransactionIntegrity" executed="True" result="Error" success="False" time="0.038" asserts="0">
                    <failure>
                      <message><![CDATA[TypeMock.DesignModeException : 
*** Faking non-virtual methods is not possible in InterfaceOnly mode. You are in InterfaceOnly mode due to one of the following :
1. Your license has expired. Please contact Typemock sales team at sales@typemock.com.
2. You applied [Isolated(DesignMode.InterfaceOnly)] in your tests while trying to fake non-virtual methods. Learn more here https://www.typemock.com/isolator-design-mode
License details: Company VSP_1xBuildSub_T Key R8C8-XXXX-XXXX-XXXX-XXXX]]></message>
                      <stack-trace><![CDATA[at TestSuite.ServicesTest.BusinessServiceTypeMockTests.SavePosPatientPayment_CheckTransactionIntegrity() in D:optjenkinsworkspaceBuild_Feature_SharedLibrary_TypemockTestServicesTestSuiteServicesTestBusinessServiceTypeMockTests.cs:line 4786
at TypeMock.MockManager.getReturn(Object context, String typeName, String methodName, Object methodGenericParams, Boolean isDecorated, Boolean isInterceptedType, Object[] methodArguments)
at Typemock.Interceptors.Profiler.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected, Boolean isInterceptedType)
at TestSuite.ServicesTest.BusinessServiceTypeMockTests.SavePosPatientPayment_CheckTransactionIntegrity() in D:optjenkinsworkspaceBuild_Feature_SharedLibrary_TypemockTestServicesTestSuiteServicesTestBusinessServiceTypeMockTests.cs:line 0
]]></stack-trace>

I deleted the workspace on Jenkins, forcing it to get everything from Git again.  So there should be no residual stuff lying around.

UPDATE:

It looks like the tests that are failing are making a call like this:

Isolate.NonPublic.WhenCalled(fakeBusinessServices, "CheckTransactionIntegrity").IgnoreCall();

or

Isolate.NonPublic.WhenCalled(fakeBusinessServices, "_HandlePaymentException").WillReturn(string.Empty);

Other methods that are failing are faking static methods like:

DateTime fakeTestDate = new DateTime(1969, 5, 16);
Isolate.WhenCalled(() => DateTime.Now).WillReturn(fakeTestDate);

I was able to resolve one issue by not using Isolate.Fake.NextInstance<>(), where the next instance was a local variable.

So it does look like its about non-interface methods being called, to some degree.

asked by jim.little (3.6k points)
edited by jim.little

2 Answers

0 votes
Hi,

Please check the following

1. Do you have the [DesignMode.InterfaceOnly] attribute?

2. Please run the Typemock.Configuration.exe and see if the license is expired or not.
answered by eli (5.7k points)
0 votes
Hi,

After an online session it seemed that the RegisterTypeMock target was not called.

You can check this via the output, there is a messge after AutoDelply and License set
answered by eli (5.7k points)
...