예제 #1
0
        public async Task FileSharing_ListOfSharedFiles_ContainsExpectedNotFoundFileNode()
        {
            var blobInfo = await BlobStorage.GetFileInfo(BlobId, JohnId.ToString());

            blobInfo.Should().NotBeNull();

            var fileEntityResponse = await JohnApi.GetSharedFiles();

            var sharedInfo = JsonConvert.DeserializeObject <JArray>(await fileEntityResponse.Content.ReadAsStringAsync());

            foreach (var node in sharedInfo)
            {
                Assert.NotEqual(node["id"].ToObject <Guid>(),
                                FileId);
            }
        }
        public async Task FileSharing_ListOfSharedFiles_ContainsExpectedFileNode()
        {
            var blobInfo = await BlobStorage.GetFileInfo(BlobId, JohnId.ToString());

            blobInfo.Should().NotBeNull();

            var fileEntityResponse = await JohnApi.GetSharedFiles();

            var sharedInfo = JsonConvert.DeserializeObject <JArray>(await fileEntityResponse.Content.ReadAsStringAsync());

            var fileNode = sharedInfo.Last();

            fileNode.Should().NotBeNull();
            fileNode.Should().ContainsJson($@"
			{{
				'id': '{FileId}',
				'type': 'File',
				'blob': {{
					'id': '{blobInfo.Id}',
					'bucket': '{JohnId}',
					'length': {blobInfo.Length},
					'md5': '{blobInfo.MD5}'
				}},
				'subType': '{FileType.Records}',
				'ownedBy': '{JohnId}',
				'createdBy': '{JohnId}',
				'createdDateTime': '{DateTime.UtcNow}',
				'updatedBy': '{JohnId}',
				'updatedDateTime': '{DateTime.UtcNow}',
				'parentId': '{JohnId}',
				'name': '{blobInfo.FileName}',
				'status': '{FileStatus.Processed}',
				'version': *EXIST*,
				'totalRecords': 1,
				'accessPermissions': {{
					'id': '{FileId}',
					'isPublic': 'True',
					'users': *EXIST*,
					'groups': *EXIST*
				}}
			}}"            );
        }