I come to you for a strange problem when I use the Visual Studio Native Unit Test on VS 2012. I\'ve a Coordinates class like that:
#ifndef COORDINATES_HPP
#d
Given the error message, you might try making your operator== more const friendly:
bool operator==( const Coordinates coordinates ) const;
The error received after creating your assignment operator, ie
Error 1 error C2338: Test writer must define specialization of ToString for your class class std::basic_string,class std::allocator > __cdecl Microsoft::VisualStudio::CppUnitTestFramework::ToString(const class Core::Coordinates &).
is related to needing to provide a way for the unit tests to print out the values it expected and received. You do this by creating a template specialization of the ToString function in the Microsoft::VisualStudio::CppUnitTestFramework
namespace. For example:
namespace Microsoft{
namespace VisualStudio {
namespace CppUnitTestFramework {
template<>
static std::wstring ToString<Coordinates>(const Coordinates & coord) {
return L"Some string representing coordinate.";
}
}
}
}
After that, the unit tests should run.