public async Task CallingHead_ShouldReturnProgressOfUploadedFile(FileInfo file) { var sut = new TusClient(); var url = await sut.CreateAsync(TusEndpoint, file.Length); var headBeforeUpload = await sut.HeadAsync(url); await sut.UploadAsync(url, file); var headAfterUpload = await sut.HeadAsync(url); headBeforeUpload.Headers.Keys.ShouldContain("Upload-Offset"); headBeforeUpload.Headers["Upload-Offset"].ShouldBe("0"); headAfterUpload.Headers.Keys.ShouldContain("Upload-Offset"); headAfterUpload.Headers["Upload-Offset"].ShouldBe(file.Length.ToString()); }
public async Task CallingDelete_ShouldRemoveUploadedFile(FileInfo file) { var sut = new TusClient(); var url = await sut.CreateAsync(TusEndpoint, file.Length); await sut.UploadAsync(url, file); var uploadHeadResponse = await sut.HeadAsync(url); var deleteResult = await sut.Delete(url); deleteResult.ShouldBe(true); uploadHeadResponse.Headers.Keys.ShouldContain("Upload-Offset"); uploadHeadResponse.Headers["Upload-Offset"].ShouldBe(file.Length.ToString()); File.Exists(Path.Combine(_dataDirectoryPath, $"url.Split('/').Last()")).ShouldBe(false); }