respect given_url if no resolved_url is given

This commit is contained in:
2013-12-27 21:34:22 +01:00
parent 85c4ca2c65
commit 670fecb1e0
3 changed files with 28 additions and 4 deletions
+14
View File
@@ -246,5 +246,19 @@ namespace PocketSharp.Tests
Assert.True(items.Count == 1 && items[0].IsDeleted);
}
[Fact]
public async Task AreUncachedItemsProperlyResolved()
{
PocketItem item = await client.Add(new Uri("http://de.ign.com/m/feature/21608/die-20-besten-kurzfilme-des-jahres-2013?bust=1"));
List<PocketItem> items = await client.Get(state: State.all);
Assert.NotNull(item.Uri);
Assert.NotNull(items[0].Uri);
Assert.Equal(item.Uri, items[0].Uri);
itemsToDelete.Add(item.ID);
}
}
}
+11 -2
View File
@@ -42,6 +42,15 @@ namespace PocketSharp.Models
[JsonProperty("normal_url")]
private Uri _NormalUri { get; set; }
/// <summary>
/// Gets or sets the given URI.
/// </summary>
/// <value>
/// The given URI.
/// </value>
[JsonProperty("given_url")]
private Uri _GivenUri { get; set; }
/// <summary>
/// Gets or sets the resolved URI.
/// </summary>
@@ -60,8 +69,8 @@ namespace PocketSharp.Models
[JsonIgnore]
public Uri Uri
{
get { return _ResolvedUri ?? _NormalUri; }
set { _NormalUri = value; _ResolvedUri = value; }
get { return _ResolvedUri ?? _GivenUri ?? _NormalUri; }
set { _NormalUri = value; _ResolvedUri = value; _GivenUri = value; }
}
/// <summary>
+3 -2
View File
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
namespace PocketSharp
{
@@ -36,7 +37,7 @@ namespace PocketSharp
/// </summary>
/// <param name="message">The message that describes the error.</param>
public PocketException(string message)
: base(message) { }
: base(message) { Debug.WriteLine(message); }
/// <summary>
@@ -45,6 +46,6 @@ namespace PocketSharp
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
public PocketException(string message, Exception innerException)
: base(message, innerException) { }
: base(message, innerException) { Debug.WriteLine(message); }
}
}