Ejemplo n.º 1
0
        public async Task SetAsyncStorageItems_ReturnsValueFromAsyncTask()
        {
            DataPackage dataPackage = new DataPackage();
            StorageFile file = await ApplicationData.Current.TemporaryFolder.CreateFileAsync("Test file.xml");

            dataPackage.SetAsyncStorageItems(async (formatId, deadline) =>
            {
                await Task.Delay(200);
                return new IStorageItem[] { file };
            });

            DataPackageView dataPackageView = dataPackage.GetView();
            IReadOnlyList<IStorageItem> result = await dataPackageView.GetStorageItemsAsync();

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual(file.Path, result[0].Path);
        }