Ejemplo n.º 1
0
        public async Task SetAsyncBitmap_ReturnsValueFromAsyncTask()
        {
            DataPackage dataPackage = new DataPackage();
            RandomAccessStreamReference streamRef = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Images/UnitTestLogo.png"));

            dataPackage.SetAsyncBitmap(async (formatId, deadline) =>
            {
                await Task.Delay(200);
                return streamRef;
            });

            DataPackageView dataPackageView = dataPackage.GetView();
            RandomAccessStreamReference result = await dataPackageView.GetBitmapAsync();

            Assert.AreEqual(streamRef, result);
        }