コード例 #1
0
        public override async Task <IEnumerable <UTILES1Schema> > GetDataAsync(SchemaBase connectedItem = null)
        {
            var config = new DynamicStorageDataConfig
            {
                Url        = new Uri("http://ds.winappstudio.com/api/data/collection?dataRowListId=ee2d3dc9-7014-44da-9432-056585f062ae&appId=c78fe7fb-d633-43d7-806d-a3f5209ea0cb"),
                AppId      = "c78fe7fb-d633-43d7-806d-a3f5209ea0cb",
                StoreId    = ApplicationData.Current.LocalSettings.Values[LocalSettingNames.StoreId] as string,
                DeviceType = ApplicationData.Current.LocalSettings.Values[LocalSettingNames.DeviceType] as string,
            };

            return(await _dataProvider.LoadDataAsync(config, MaxRecords));
        }
コード例 #2
0
        public override async Task <IEnumerable <Fournitures1Schema> > GetDataAsync(SchemaBase connectedItem = null)
        {
            var config = new DynamicStorageDataConfig
            {
                Url        = new Uri("http://ds.winappstudio.com/api/data/collection?dataRowListId=c05afe4b-61ea-4574-b8bd-5d63af7e5b76&appId=c78fe7fb-d633-43d7-806d-a3f5209ea0cb"),
                AppId      = "c78fe7fb-d633-43d7-806d-a3f5209ea0cb",
                StoreId    = ApplicationData.Current.LocalSettings.Values[LocalSettingNames.StoreId] as string,
                DeviceType = ApplicationData.Current.LocalSettings.Values[LocalSettingNames.DeviceType] as string,
            };

            return(await _dataProvider.LoadDataAsync(config, MaxRecords));
        }
コード例 #3
0
        public override async Task <IEnumerable <Learning1Schema> > GetDataAsync(SchemaBase connectedItem = null)
        {
            var config = new DynamicStorageDataConfig
            {
                Url        = new Uri("http://ds.winappstudio.com/api/data/collection?dataRowListId=fa57f726-f6d6-4ff1-a09e-506b090e5a5a&appId=d042324a-6aed-4021-85ce-6bd02a90a155"),
                AppId      = "d042324a-6aed-4021-85ce-6bd02a90a155",
                StoreId    = ApplicationData.Current.LocalSettings.Values[LocalSettingNames.StoreId] as string,
                DeviceType = ApplicationData.Current.LocalSettings.Values[LocalSettingNames.DeviceType] as string,
            };

            return(await _dataProvider.LoadDataAsync(config, MaxRecords));
        }
コード例 #4
0
        public async Task TestDynamicNullUrlConfig()
        {
            var config = new DynamicStorageDataConfig
            {
                Url = null
            };

            var dataProvider = new DynamicStorageDataProvider <CollectionSchema>();

            ConfigParameterNullException exception = await ExceptionsAssert.ThrowsAsync <ConfigParameterNullException>(async() => await dataProvider.LoadDataAsync(config));

            Assert.IsTrue(exception.Message.Contains("Url"));
        }
コード例 #5
0
        public async Task LoadMoreDataInvalidOperationDynamicCollection()
        {
            var config = new DynamicStorageDataConfig
            {
                AppId      = Guid.Empty.ToString(),
                StoreId    = Guid.Empty.ToString(),
                DeviceType = "WINDOWS",
                Url        = new Uri("http://appstudio-dev.cloudapp.net/api/data/collection?dataRowListId=6db1e7d0-5216-4519-8978-d51f1452f9f2&appId=7c181582-15d0-42f7-b3eb-ab5d2e7d2c8a")
            };

            var dataProvider = new LocalStorageDataProvider <CollectionSchema>();
            InvalidOperationException exception = await ExceptionsAssert.ThrowsAsync <InvalidOperationException>(async() => await dataProvider.LoadMoreDataAsync());
        }
コード例 #6
0
        public async Task LoadDynamicCollection()
        {
            var config = new DynamicStorageDataConfig
            {
                AppId      = Guid.Empty.ToString(),
                StoreId    = Guid.Empty.ToString(),
                DeviceType = "WINDOWS",
                Url        = new Uri("http://appstudio-dev.cloudapp.net/api/data/collection?dataRowListId=6db1e7d0-5216-4519-8978-d51f1452f9f2&appId=7c181582-15d0-42f7-b3eb-ab5d2e7d2c8a")
            };

            var dataProvider = new DynamicStorageDataProvider <CollectionSchema>();
            IEnumerable <CollectionSchema> data = await dataProvider.LoadDataAsync(config);

            Assert.IsNotNull(data);
            Assert.AreNotEqual(data.Count(), 0);
        }
コード例 #7
0
        public async Task LoadDynamicCollection_ByIds()
        {
            var config = new DynamicStorageDataConfig
            {
                AppId      = Guid.Empty.ToString(),
                StoreId    = Guid.Empty.ToString(),
                DeviceType = "WINDOWS",
                Url        = new Uri("http://appstudio-dev.cloudapp.net/api/data/collectionitemsbyid?dataRowListId=6db1e7d0-5216-4519-8978-d51f1452f9f2&appId=7c181582-15d0-42f7-b3eb-ab5d2e7d2c8a")
            };

            var ids = new List <string>();

            ids.Add("565f3175e3ef7f275c35da95");
            ids.Add("565f3175e3ef7f275c35da97");

            var dataProvider = new DynamicStorageDataProvider <CollectionSchema>();
            IEnumerable <CollectionSchema> data = await dataProvider.GetDataByIdsAsync <CollectionSchema>(config, ids);

            Assert.IsNotNull(data);
            Assert.AreEqual(2, data.Count());
        }
コード例 #8
0
        public async Task LoadMoreDynamicCollection_Sorting()
        {
            var config = new DynamicStorageDataConfig
            {
                AppId      = Guid.Empty.ToString(),
                StoreId    = Guid.Empty.ToString(),
                DeviceType = "WINDOWS",
                Url        = new Uri("http://appstudio-dev.cloudapp.net/api/data/collection?dataRowListId=6389c5e8-788e-42cc-8b74-a16fca5e4bf3&appId=d3fdeca1-ee0e-482c-bc19-82e344d2b78c")
            };

            var dataProvider = new DynamicStorageDataProvider <CollectionSchema2>();

            config.OrderBy        = "Title";
            config.OrderDirection = SortDirection.Ascending;
            IEnumerable <CollectionSchema2> dataAsc = await dataProvider.LoadDataAsync(config, 2);

            dataAsc = await dataProvider.LoadMoreDataAsync();

            config.OrderDirection = SortDirection.Descending;
            IEnumerable <CollectionSchema2> dataDesc = await dataProvider.LoadDataAsync(config, 2);

            dataDesc = await dataProvider.LoadMoreDataAsync();

            var dataExpected = dataAsc.OrderBy(x => x.Title).ToList();

            for (int i = 0; i < dataExpected.Count() - 1; i++)
            {
                Assert.AreEqual(dataExpected[i].Title, dataAsc.ToList()[i].Title);
            }

            dataExpected = dataDesc.OrderByDescending(x => x.Title).ToList();
            for (int i = 0; i < dataExpected.Count() - 1; i++)
            {
                Assert.AreEqual(dataExpected[i].Title, dataDesc.ToList()[i].Title);
            }

            config.OrderBy        = "Date";
            config.OrderDirection = SortDirection.Ascending;
            dataAsc = await dataProvider.LoadDataAsync(config, 2);

            dataAsc = await dataProvider.LoadMoreDataAsync();

            config.OrderDirection = SortDirection.Descending;
            dataDesc = await dataProvider.LoadDataAsync(config, 2);

            dataDesc = await dataProvider.LoadMoreDataAsync();

            dataExpected = dataAsc.OrderBy(x => x.Date).ToList();
            for (int i = 0; i < dataExpected.Count() - 1; i++)
            {
                Assert.AreEqual(dataExpected[i].Title, dataAsc.ToList()[i].Title);
            }

            dataExpected = dataDesc.OrderByDescending(x => x.Date).ToList();
            for (int i = 0; i < dataExpected.Count() - 1; i++)
            {
                Assert.AreEqual(dataExpected[i].Title, dataDesc.ToList()[i].Title);
            }

            config.OrderBy        = "DateTime";
            config.OrderDirection = SortDirection.Ascending;
            dataAsc = await dataProvider.LoadDataAsync(config, 2);

            dataAsc = await dataProvider.LoadMoreDataAsync();

            config.OrderDirection = SortDirection.Descending;
            dataDesc = await dataProvider.LoadDataAsync(config, 2);

            dataDesc = await dataProvider.LoadMoreDataAsync();

            dataExpected = dataAsc.OrderBy(x => x.DateTime).ToList();
            for (int i = 0; i < dataExpected.Count() - 1; i++)
            {
                Assert.AreEqual(dataExpected[i].Title, dataAsc.ToList()[i].Title);
            }

            dataExpected = dataDesc.OrderByDescending(x => x.DateTime).ToList();
            for (int i = 0; i < dataExpected.Count() - 1; i++)
            {
                Assert.AreEqual(dataExpected[i].Title, dataDesc.ToList()[i].Title);
            }
        }