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

I have a MS Test project to Test a sample class shown below.

class MyTestClass
{
public:
	const int ReturnInt() const { return -1; }
	double ReturnDouble() const { return -1.0; }
	const double ReturnConstDouble() const { return -1.0; }
};

The above class is tested as shown below.

namespace UnitTest1
{
	TEST_CLASS(Mock_Test)
	{
		TEST_METHOD_CLEANUP(TearDown)
		{
			ISOLATOR_CLEANUP();
		}
		TEST_METHOD(Mock_Trial);
	};
}
void UnitTest1::Mock_Test::Mock_Trial()
{
	MyTestClass* fakeTestClass = FAKE<MyTestClass>();

	WHEN_CALLED(fakeTestClass->ReturnConstInt()).Return(10);
	WHEN_CALLED(fakeTestClass->ReturnDouble()).Return(10.0);
	WHEN_CALLED(fakeTestClass->ReturnConstDouble()).Return(10.0);

	Assert::AreEqual(10, fakeTestClass->ReturnConstInt());
	Assert::AreEqual(10.0, fakeTestClass->ReturnDouble());
	Assert::AreEqual(10.0, fakeTestClass->ReturnConstDouble());
}

In the Asserts done in Mock_Trial(), the Assert for ReturnConstInt and ReturnDouble are fine but Assert for ReturnConstDouble is failing. The fakeTestClass->ReturnConstDouble() is returning 0. Why is this happening?

Visual Studio 2017 version 15.9.25

Isolator++ version 4.1.2.20

asked by anoop.kodavath (600 points)

Hi Annop,

Can you please run the test with logs and sent them to me.

To enable logs you can find all the information on this LINK.

Cheers,

Alon Sapozhnikov

Support Spcialist

2 Answers

0 votes

Hi Annop, 

Thank you for the input, we are checking the issue.

We will keep you posted.

Cheers,

Alon Sapozhnikov.

Support Specialist. 

answered by Alon_TypeMock (3.2k points)
0 votes

Hi Annop,

I'v very sorry for the inconvenience.
I'm glad to say that we have managed to fix the issue.

You can download our latest version from the site which includes the fix.

Cheers, 

Alon Sapozhnikov.

Support Specialist.

answered by Alon_TypeMock (3.2k points)
...