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
I get the following error from Typemock

failed: TypeMock.TypeMockException :
*** No method LoadClasses<IPlugInAccessPoint> in type Cassiopeia.Core.ClassLoader returns System.Collections.Generic.List`1[Cassiopeia.CoreGui.IPlugInAccessPoint]
at TypeMock.Mock.a(String A_0, Object A_1, Boolean A_2, Boolean A_3, Int32 A_4, Type[] A_5)
at TypeMock.Mock.ExpectAndReturn(String method, Object ret, Int32 timesToRun, Type[] genericTypes)
at TypeMock.Mock.ExpectAndReturn(String method, Object ret, Type[] genericTypes)

Even though my Class Contain the following (i.e. plenty of matches):

public ref class ClassLoader
{
public:
generic<typename RecognicedInterfaceT>
where RecognicedInterfaceT : ref class
static List<RecognicedInterfaceT> ^LoadClasses(ClassInstancesFactory<RecognicedInterfaceT> ^factory, String ^path, bool recursive);
generic<typename RecognicedInterfaceT>
where RecognicedInterfaceT : ref class
static List<RecognicedInterfaceT> ^LoadClasses(ClassInstancesFactory<RecognicedInterfaceT> ^factory, String ^path);
generic<typename RecognicedInterfaceT>
where RecognicedInterfaceT : ref class
static List<RecognicedInterfaceT> ^LoadClasses(String ^path, bool recursive);
generic<typename RecognicedInterfaceT>
where RecognicedInterfaceT : ref class
static List<RecognicedInterfaceT> ^LoadClasses(String ^path);
}
asked by jho1965dk (1.7k points)

7 Answers

0 votes
Hi
Welcome to the forum :)
Can you please post your test code?
answered by ohad (35.4k points)
0 votes
ICollection<IPlugInAccessPoint^> ^ret = gcnew List<IPlugInAccessPoint^>;
classLoaderMock->ExpectAndReturn("LoadClasses",ret,IPlugInAccessPoint::typeid)->Args(".");
answered by jho1965dk (1.7k points)
0 votes
Hi
Can you post the ALL of the code of your test method? :?
answered by ohad (35.4k points)
0 votes
Here is a small example code that have the same problem:

// typemock_test.h

#pragma once

using namespace System;
using namespace TypeMock;
using namespace NUnit::Framework;

namespace typemock_test {

generic<typename T>
public ref class Class0
{
public:
Class0(int i)
{
}
};

public ref class Class1
{
public:
generic<typename T>
where T : ref class
static Class0<T> ^Foo(int i)
{
return gcnew Class0<T>(1);
}

generic<typename T>
where T : ref class
static Class0<T> ^Foo(int i, int j)
{
return gcnew Class0<T>(2);
}
};

[TestFixture]
public ref class Test1
{
public:
[Test]
void Test()
{
MockManager::Init ();
Mock ^classMock = MockManager::Mock(Class1::typeid);
Class0<String ^> ^ret = gcnew Class0<String ^>(1);
classMock->ExpectAndReturn("Foo",ret,String::typeid)
->Args(1);
}
};

}

output when running Test():

------ Test started: Assembly: typemock_test.dll ------

TestCase 'typemock_test.Test1.Test'
failed: TypeMock.TypeMockException :
*** No method Foo<String> in type typemock_test.Class1 returns typemock_test.Class0`1[System.String]
at TypeMock.Mock.a(String A_0, Object A_1, Boolean A_2, Boolean A_3, Int32 A_4, Type[] A_5)
at TypeMock.Mock.ExpectAndReturn(String method, Object ret, Int32 timesToRun, Type[] genericTypes)
at TypeMock.Mock.ExpectAndReturn(String method, Object ret, Type[] genericTypes)
c:documents and settings0394914my documentsisual studio 2005projects ypemock_test ypemock_test ypemock_test.h(49,0): at typemock_test.Test1.Test()


0 passed, 1 failed, 0 skipped, took 5,50 seconds.
answered by jho1965dk (1.7k points)
0 votes
Hi
It looks like we have a bug.
Thank you for reporting. We will fix it and send you the patch offline.
answered by ohad (35.4k points)
0 votes
Hi
The patch was created and sent to you.
Please tell me if it solves your problem.
answered by ohad (35.4k points)
0 votes
Hi Ohad

The Patch fixed the problem :-)

Thanks
/Jens
answered by jho1965dk (1.7k points)
...