8using namespace Microsoft::VisualStudio::CppUnitTestFramework;
29 std::function<bool ()>
init = [&]()
42 std::function<bool ()>
start = [&]()
57 std::function<bool ()>
stop = [&]()
62 std::function<bool ()>
exit = [&]()
79 TEST_CLASS_INITIALIZE (ClassInitialize)
81 Logger::WriteMessage (
"class initialize.\n");
84 TEST_CLASS_CLEANUP (ClassCleanup)
86 Logger::WriteMessage (
"class cleanup.\n");
89 TEST_METHOD_INITIALIZE (MethodInitialize)
91 Logger::WriteMessage (
"method initialize.\n");
94 TEST_METHOD_CLEANUP (MethodCleanup)
96 Logger::WriteMessage (
"method cleanup.\n");
99 TEST_METHOD (SequencialCall)
106 data.
SetByte ((LPBYTE)
"1234567890", 10);
111 bool ret = t.
Init (f.init);
112 Assert::AreEqual<bool> (
true, ret);
114 }(workerTemplate, workerFunction);
118 bool ret = t.
Start (f.start);
119 Assert::AreEqual<bool> (
true, ret);
121 }(workerTemplate, workerFunction);
125 bool ret = t.
Command (f.command, msg);
126 Assert::AreEqual<bool> (
true, ret);
128 }(workerTemplate, workerFunction, message);
133 Assert::AreEqual (0, lstrcmpA (
"1234567890", (LPSTR)ret.
GetByte ()));
135 }(workerTemplate, workerFunction, data);
139 bool ret = t.
Stop (f.stop);
140 Assert::AreEqual<bool> (
true, ret);
142 }(workerTemplate, workerFunction);
146 bool ret = t.
Exit (f.exit);
147 Assert::AreEqual<bool> (
true, ret);
149 }(workerTemplate, workerFunction);
void SetByte(LPBYTE pbyData, DWORD dwSize)
void SetCommand(int command)
std::function< bool()> init
std::function< bool()> stop
std::function< bool(Message message)> command
std::function< bool()> exit
std::function< bool()> start
virtual ~WorkerFunction()
std::function< Data(Data data)> process
bool Stop(Function function)
終了処理
bool Start(Function function)
開始処理
bool Exit(Function function)
退出処理
bool Init(Function function)
初期化処理
bool Command(Function function, Message message)
コマンド処理
Data Process(Function function, Data data)
プロセス処理
TEST_CLASS(DesignPatternTest)