#ifndef _MOCK_ENVIRONMENT_OBJECT_H #define _MOCK_ENVIRONMENT_OBJECT_H #include "Composite.h" #include "EnvironmentObject.h" #include "Logger.h" std::string _createEnvironmentObject = "+EObject"; std::string _deleteEnvironmentObject = "-EObject"; std::string _envObjectUpdateImage = "->UM"; std::string _envObjectUpdateEntity = "->UE"; std::string _envObjectUpdateIdent = "->UI"; std::string _envObjectUpdateType = "->UT"; template <typename T> class MockEnvironmentObject : public IEnvironmentObject<T> { public: MockEnvironmentObject(IComponent<T>* pComponent, ILogger* logger) : IEnvironmentObject<T>(pComponent), logger_(logger) { if (logger_) logger_->Add(EasyString(_createEnvironmentObject.c_str())); } virtual ~MockEnvironmentObject() { if (logger_) logger_->Add(EasyString(_deleteEnvironmentObject.c_str())); } virtual void Update () { if (pComponent_->Object().CurrentState() == TestObject::UpdateImage) { if (logger_) logger_->Add(EasyString(_envObjectUpdateImage.c_str())); } else if (pComponent_->Object().CurrentState() == TestObject::UpdateEntity) { if (logger_) logger_->Add(EasyString(_envObjectUpdateEntity.c_str())); } else if (pComponent_->Object().CurrentState() == TestObject::UpdateIdent) { if (logger_) logger_->Add(EasyString(_envObjectUpdateIdent.c_str())); } else if (pComponent_->Object().CurrentState() == TestObject::UpdateType) { if (logger_) logger_->Add(EasyString(_envObjectUpdateType.c_str())); } } protected: ILogger* logger_; }; #endif
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)