fix PocketAction conversion exception when no ID is given; fixes #20

This commit is contained in:
2014-02-17 23:30:15 +01:00
parent 07357b9327
commit 585c203f9a
2 changed files with 16 additions and 1 deletions
+15
View File
@@ -88,6 +88,21 @@ namespace PocketSharp.Tests
}
[Fact]
public async Task AreMultipleAddActionsSent()
{
PocketItem item = await Setup();
bool success = await client.SendActions(new List<PocketAction>()
{
new PocketAction() { Action = "add", Uri = new Uri("http://msdn.microsoft.com/en-us/library/windows/apps/jj841126.aspx") },
new PocketAction() { Action = "add", Uri = new Uri("http://pokiapp.com/changelog") }
});
Assert.True(success);
}
private async Task<PocketItem> Setup()
{
PocketItem item = await client.Add(
+1 -1
View File
@@ -105,7 +105,7 @@ namespace PocketSharp.Models
{ "action", Action }
};
if (ID != "0" && !String.IsNullOrEmpty(ID.ToString()))
if (!String.IsNullOrEmpty(ID) && ID != "0")
parameters.Add("item_id", ID.ToString());
if (Time != null)
parameters.Add("time", Time != null ? Utilities.GetUnixTimestamp(Time).ToString() : null);