public async Task GetMediaItemsForDeviceAsync()
        {
            var deviceId = Guid.NewGuid().ToId();
            var media    = new DeviceMedia
            {
                ItemId      = Guid.NewGuid().ToId(),
                ContentType = "text",
                DeviceId    = deviceId,
                FileName    = "filename.txt",
                Length      = 10,
                TimeStamp   = DateTime.Now.ToJSONString(),
                Title       = "my file"
            };
            var response = await DataFactory.DeviceMediaItemRepoRemote.StoreMediaItemAsync(DataFactory.DeviceRepo, media);

            Assert.IsTrue(response.Successful);

            var listRequest = new ListRequest
            {
                PageIndex = 1,
                PageSize  = 25
            };
            var listResponse = await DataFactory.DeviceMediaItemRepo.GetMediaItemsForDeviceAsync(DataFactory.DeviceRepo, deviceId, listRequest);

            Assert.IsTrue(listResponse.Successful);
            Assert.IsTrue(listResponse.Model.Count() > 0);
        }
Esempio n. 2
0
        public async Task <InvokeResult> StoreMediaItemAsync(DeviceRepository repo, DeviceMedia media)
        {
            SetConnection(repo.DeviceArchiveStorageSettings.AccountId, repo.DeviceArchiveStorageSettings.AccessKey);
            SetTableName(repo.GetDeviceMediaStorageName());

            await base.InsertAsync(DeviceMediaTableStorageEntity.FromDeviceMedia(media));

            return(InvokeResult.Success);
        }
Esempio n. 3
0
 public static DeviceMediaTableStorageEntity FromDeviceMedia(DeviceMedia item)
 {
     return(new DeviceMediaTableStorageEntity()
     {
         DeviceId = item.DeviceId,
         RowKey = DateTime.UtcNow.ToInverseTicksRowKey().Replace(".", "-"),
         PartitionKey = item.DeviceId,
         ContentType = item.ContentType,
         TimeStamp = item.TimeStamp,
         FileName = item.FileName,
         Title = item.Title,
     });
 }
        public async Task StoreMediaItemAsync()
        {
            var deviceId = Guid.NewGuid().ToId();
            var media    = new DeviceMedia
            {
                ItemId      = Guid.NewGuid().ToId(),
                ContentType = "text",
                DeviceId    = deviceId,
                FileName    = "filename.txt",
                Length      = 10,
                TimeStamp   = DateTime.Now.ToJSONString(),
                Title       = "my file"
            };
            var response = await DataFactory.DeviceMediaItemRepoRemote.StoreMediaItemAsync(DataFactory.DeviceRepo, media);

            Assert.IsTrue(response.Successful);
        }