I have the following "Windows Store/Metro Style" test methods in VS 2012 C++/CX
This one succeeds, which is ok
TEST_METHOD(TestMethod)
{
bool passed = false;
concurrency::event finished;
finished.reset();
auto testTask = concurrency::create_task( [&finished, &passed]()
{
passed = true;
finished.set();
});
finished.wait(100000);
Assert::IsTrue(passed);
}
This one fails, which is also ok:
TEST_METHOD(TestMethod)
{
bool passed = true;
concurrency::event finished;
finished.reset();
auto testTask = concurrency::create_task( [&finished, &passed]()
{
passed = false;
finished.set();
});
finished.wait(100000);
Assert::IsTrue(passed);
}
But for some reason, this test does not fail:
TEST_METHOD(FailedTest)
{
concurrency::event finished;
finished.reset();
auto testTask = concurrency::create_task( [&finished]()
{
Assert::IsTrue(false);
finished.set();
});
finished.wait(100000);
}
Am I doing something wrong?
As a side note, a possible work-around could be to put all the results of my tests in variables and "test" them all after finished.wait(100000);
, but I still would like to know if there is something actually wrong with what I am doing.
finished.wait
calltestTask
? – Smoko