Пример #1
0
        public async Task FileSharing_WithUnauthorizeUser_ReturnsExpectedNotFoundFileEntity()
        {
            var response = await UnauthorizedApi.GetFileEntityById(FileId);

            response.IsSuccessStatusCode.Should().Be(false);
            response.StatusCode.Should().Be(HttpStatusCode.NotFound);
            //response.ReasonPhrase.ShouldAllBeEquivalentTo("Not Found");
        }
Пример #2
0
        public async Task FileSharing_WithUnauthorizeUser_ReturnsExpectedNotFoundFileEntity()
        {
            var blobInfo = await BlobStorage.GetFileInfo(BlobId, JohnId.ToString());

            blobInfo.Should().NotBeNull();

            var response = await UnauthorizedApi.GetFileEntityById(FileId);

            response.IsSuccessStatusCode.ShouldBeEquivalentTo(false);
//			response.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.NotFound);
//			response.ReasonPhrase.ShouldAllBeEquivalentTo("Not Found");
        }
        public async Task FileSharing_WithUnauthorizeUser_ReturnsExpectedFileEntity()
        {
            var blobInfo = await BlobStorage.GetFileInfo(BlobId, JohnId.ToString());

            blobInfo.Should().NotBeNull();

            var fileEntityResponse = await UnauthorizedApi.GetFileEntityById(FileId);

            fileEntityResponse.EnsureSuccessStatusCode();
            fileEntityResponse.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.OK);
            var fileEntity = JsonConvert.DeserializeObject <JObject>(await fileEntityResponse.Content.ReadAsStringAsync());

            fileEntity.Should().ContainsJson($@"
			{{
				'id': '{FileId}',
				'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,
			}}"            );
            fileEntity["properties"].Should().NotBeEmpty();
            fileEntity["properties"].Should().HaveCount(2);
            fileEntity["images"].Should().HaveCount(1);
        }