locked
How to use async function in unittest project by c++?

    Question

  • Hi all,

    I don't know what happen for my code.
    The expect result is fail
    But, the actual result is fine

    [Reproduce Steps]
    1. New Unittest project
    2. include header file and add namespace
    3. input code
    4. Run unittest, the result is fine..

    IAsyncOperation<DeviceInformationCollection^>^ deviceOp = DeviceInformation::FindAllAsync();
    task<DeviceInformationCollection^> deviceEnumTask(deviceOp);
    deviceEnumTask.then( [this] (DeviceInformationCollection^ devices ) 
    {		
    	bool test = true;
    	Assert::IsFalse(test);
    });

    Is there any mistake for my code?

    Thanks

    Thursday, June 28, 2012 7:09 AM

Answers

  • Currently we don't have support for Async in C++ Metro unit Test Library. We are tracking this is in our product backlog for a future release.

    In the interim, please refer http://hilo.codeplex.com for guidance around handling async tests. Specifically, the TestHelper class has helper methods  for async testing.


    Wednesday, July 4, 2012 3:40 AM

All replies

  • Hello,
     
    Thanks for your feedback, I will involve more experts to investigate it.
     
    Best regards,
    Jesse

    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Monday, July 2, 2012 10:51 AM
  • Currently we don't have support for Async in C++ Metro unit Test Library. We are tracking this is in our product backlog for a future release.

    In the interim, please refer http://hilo.codeplex.com for guidance around handling async tests. Specifically, the TestHelper class has helper methods  for async testing.


    Wednesday, July 4, 2012 3:40 AM
  • Has there been any update on this? I too would like to support the

    RoInitializeWrapper

    initialize(RO_INIT_MULTITHREADED);

    call in my unit tests but so far have not found a way to have multi-threaded unit tests.

    Wednesday, March 26, 2014 12:41 AM