internal void GetDetails_WithValidArgument_MustResultSpectedValue(DTOs.File param) { var client = ClientBuilder.Create().Build(); var service = new OneDriveService(client); var value = service.GetDetails(param); Assert.NotNull(value); Assert.Equal("id", value.ID); }
internal FileVM GetDetails(DTOs.File fileDTO) { return(new FileVM { ID = fileDTO.id, Name = fileDTO.name, Path = GetPath(fileDTO.parentReference.path), CreatedDateTime = GetDetails_CreatedDateTime(fileDTO.createdDateTime), SizeInBytes = fileDTO.size, KeyValues = new Dictionary <string, string> { { "downloadUrl", fileDTO.downloadUrl } }, ParentID = fileDTO.parentReference.id }); }
internal async void Upload_WithValidData_MustResultAsSpected() { var driveID = "driveID"; var fileID = "fileID"; var httpPath = $"drives/{driveID}/items/{driveID}!{fileID}/content"; var fileDTO = new DTOs.File { id = "fileID", name = "fileName", parentReference = new DTOs.DirectoryParent { path = "/parentFolder", id = "parentID" } }; var fileVM = new FileVM { ID = "fileID" }; var client = ClientBuilder.Create().With(httpPath, fileDTO).Build(); var service = new OneDriveService(client); var value = await service.Upload($"{driveID}!{fileID}", new byte[] { }); Assert.NotNull(value); Assert.Equal(fileVM.ID, value.ID); }
internal async void UploadThumbnail_WithValidData_MustResultAsSpected() { var driveID = "driveID"; var fileID = "fileID"; var imageStream = new MemoryStream(new byte[] { }); var fileDTO = new DTOs.File { id = "fileID" }; var client = ClientBuilder.Create().With("", fileDTO).Build(); var service = new OneDriveService(client); var value = await service.UploadThumbnail($"{driveID}!{fileID}", imageStream); Assert.True(value); }
internal async void GetDetails_WithValidData_MustResultSpected() { var fileID = "driveID!fileID"; var file = new DTOs.File { id = "id", name = "name", size = 123, downloadUrl = "http://test.com", parentReference = new DTOs.DirectoryParent { path = "/parent/folderName" }, createdDateTime = "2020-08-05 20:22:15", }; var client = ClientBuilder.Create().With("", file).Build(); var service = new OneDriveService(client); var value = await service.GetDetails(fileID); Assert.NotNull(value); Assert.Equal(file.id, value.ID); }