I have
template<class A, class B>
class Retriever
{
public:
using RetrievalFunction = std::function<void (B& b, const A& a)>;
using RetrievalResult = std::unordered_map<std::string, RetrievalFunction>;
std::vector<std::string> getEntries() const;
void addEntries(const std::string& key, RetrievalFunction function);
void retrieve(const std::string& key, B& b, const A& a);
private:
RetrievalResult m_result;
}
and am trying to mock the RetrievalResult m_result to test the member functions of this class. My apologies on the ambiguity on retrieve function and the templated classes, retrieve() is something that will be used in a service application and it'll provide B and A, which are again another service and library.
The thing is, I could easily mock a map like of a type std::unordered_map<std::string, std::string>; however, with TWO templated classes and TWO usings that are nested in one another, I keep getting errors like it's not a class type, does not name a type, etc.
How can I unit test functions of a class like this?
Aucun commentaire:
Enregistrer un commentaire