diff --git a/PocketSharp.Tests/AddTests.cs b/PocketSharp.Tests/AddTests.cs index 997b7e8..8093d19 100644 --- a/PocketSharp.Tests/AddTests.cs +++ b/PocketSharp.Tests/AddTests.cs @@ -70,25 +70,56 @@ namespace PocketSharp.Tests [Fact] public async Task ItemViaActionsIsAdded() { - var uri = new Uri("http://frontendplay.com/story/4015/string-indexer-for-text-resources-in-nancy"); + List actions = new List(); - PocketAction action = new PocketAction() + actions.Add(new PocketAction() { - Uri = uri, + Uri = new Uri("http://frontendplay.com/story/4015/string-indexer-for-text-resources-in-nancy"), Action = "add", Time = DateTime.Now - }; + }); - bool success = await client.SendAction(action); + bool success = await client.SendActions(actions); Assert.True(success); - IEnumerable items = await client.Search("String Indexer"); + IEnumerable items = await client.Search("in nancy"); Assert.NotNull(items); Assert.True(items.Count() > 0); itemsToDelete.Add(items.First().ID); } + + + [Fact] + public async Task ItemsViaActionsIsAdded() + { + List actions = new List(); + + actions.Add(new PocketAction() + { + Uri = new Uri("http://frontendplay.com/story/4015/string-indexer-for-text-resources-in-nancy"), + Action = "add", + Time = DateTime.Now + }); + actions.Add(new PocketAction() + { + Uri = new Uri("http://frontendplay.com/story/4013/build-a-custom-razor-viewbase-in-nancy"), + Action = "add", + Time = DateTime.Now + }); + + bool success = await client.SendActions(actions); + + Assert.True(success); + + IEnumerable items = await client.Search("in nancy"); + + Assert.NotNull(items); + Assert.True(items.Count() == 2); + + itemsToDelete.AddRange(items.Select(item => item.ID)); + } } } diff --git a/PocketSharp/Models/PocketAction.cs b/PocketSharp/Models/PocketAction.cs index d030c8e..ba8c071 100644 --- a/PocketSharp/Models/PocketAction.cs +++ b/PocketSharp/Models/PocketAction.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.Runtime.Serialization; @@ -120,7 +121,7 @@ namespace PocketSharp.Models if (!String.IsNullOrEmpty(TweetID)) parameters.Add("ref_id", TweetID); if (Uri != null) - parameters.Add("uri", Uri.ToString()); + parameters.Add("url", Uri.OriginalString); return parameters; } diff --git a/PocketSharp/Models/Response/Modify.cs b/PocketSharp/Models/Response/Modify.cs index 24895c4..38a3c38 100644 --- a/PocketSharp/Models/Response/Modify.cs +++ b/PocketSharp/Models/Response/Modify.cs @@ -14,7 +14,7 @@ namespace PocketSharp.Models /// /// The action results. /// - [JsonProperty("action_results")] - public bool[] ActionResults { get; set; } + //[JsonProperty("action_results")] + //public bool[] ActionResults { get; set; } } } diff --git a/PocketSharp/PocketClient.cs b/PocketSharp/PocketClient.cs index 91942fa..f60de80 100644 --- a/PocketSharp/PocketClient.cs +++ b/PocketSharp/PocketClient.cs @@ -316,9 +316,7 @@ namespace PocketSharp "actions", JsonConvert.SerializeObject(actionParameters.Select(action => action.Convert())) }}; - Modify result = (await Request("send", cancellationToken, parameters)); - - return result.ActionResults != null ? !result.ActionResults.Contains(false) : result.Status; + return (await Request("send", cancellationToken, parameters)).Status; }