Last active
December 12, 2015 09:19
-
-
Save bkuhns/4750954 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "IDbService.h" | |
class AdoService : public IDbService { | |
public: | |
static AdoService& instance() override; | |
QueryResult runQuery(string query) override; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "AdoService.h" | |
class DataModel : public Persistable { | |
public: | |
DataModel(DbService& dbService = AdoService::instance()); | |
private: | |
PersistenceReport readData() override; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IDbService { | |
public: | |
static IDbService& instance() = 0; | |
QueryResult runQuery(string query) = 0; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "DataModel.h" | |
#include "MockDbService.h" | |
int main() { | |
DataModel model; | |
DataModel testModel(MockDbService::instance()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment