public void Test_UnstarAFile() { var request = new UnstarFileRequest(FakeToken, FakeRepoId, "/test/file.txt"); var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent("\"success\"") }; Assert.IsTrue(request.CommandUri.StartsWith("api2/starredfiles/")); Assert.AreEqual(HttpAccessMethod.Delete, request.HttpAccessMethod); var webRequest = TestConnection.CreateHttpRequestMessage(DummyServerUri, request); Assert.AreEqual(HttpMethod.Delete, webRequest.Method); var targetUri = webRequest.RequestUri.ToString(); Assert.IsTrue(targetUri.StartsWith(DummyServerUri + "api2/starredfiles/")); Assert.IsTrue(targetUri.Contains("repo_id=" + FakeRepoId)); Assert.IsTrue(targetUri.Contains("p=%2Ftest%2Ffile.txt")); Assert.IsTrue(request.WasSuccessful(response)); Assert.IsTrue(ExecuteSync(() => request.ParseResponseAsync(response))); }
/// <summary> /// Removes the file from the list of starred files /// </summary> /// <param name="dirEntry">The file to unstar</param> public async Task <bool> UnstarFile(SeafDirEntry dirEntry) { var request = new UnstarFileRequest(AuthToken, dirEntry.LibraryId, dirEntry.Path); return(await _webConnection.SendRequestAsync(ServerUri, request)); }