Revert "sliiim"

This reverts commit 816e06269f.
This commit is contained in:
2014-07-27 15:19:14 +02:00
parent b284cfc7cc
commit 77af7cf20e
4 changed files with 88 additions and 36 deletions
+16 -16
View File
@@ -33,23 +33,23 @@ namespace PocketSharp.Tests
Assert.True(item.Uri == itemDuplicate.Uri); Assert.True(item.Uri == itemDuplicate.Uri);
} }
// [Fact] [Fact]
// public async Task IsItemJsonPopulated() public async Task IsItemJsonPopulated()
// { {
// List<PocketItem> items = (await client.Get()).ToList(); List<PocketItem> items = (await client.Get()).ToList();
// string schemaJson = @"{ string schemaJson = @"{
// 'description': 'PocketItem', 'description': 'PocketItem',
// 'type': 'object' 'type': 'object'
// }"; }";
// JsonSchema schema = JsonSchema.Parse(schemaJson); JsonSchema schema = JsonSchema.Parse(schemaJson);
// foreach (var pocketItem in items) foreach (var pocketItem in items)
// { {
// Assert.True(!string.IsNullOrWhiteSpace(pocketItem.Json)); Assert.True(!string.IsNullOrWhiteSpace(pocketItem.Json));
// var jObject = JObject.Parse(pocketItem.Json); var jObject = JObject.Parse(pocketItem.Json);
// Assert.True(jObject.IsValid(schema)); Assert.True(jObject.IsValid(schema));
// } }
// } }
[Fact] [Fact]
public async Task AreFilteredItemsRetrieved() public async Task AreFilteredItemsRetrieved()
+5 -19
View File
@@ -105,27 +105,13 @@ namespace PocketSharp.Tests
string[] tag; string[] tag;
Random rnd = new Random(); Random rnd = new Random();
var items = urls.Skip(offset).Take(count) foreach (string url in urls.Skip(offset).Take(count))
.Select((value, idx) => new { Value = value, Index = idx })
.GroupBy(item => item.Index / 100, item => item.Value)
.Cast<IEnumerable<string>>();
foreach (IEnumerable<string> urlGroup in items)
{ {
await Task.WhenAll(urlGroup.Select(url => r = rnd.Next(tags.Length);
{ r2 = rnd.Next(tags.Length);
r = rnd.Next(tags.Length); tag = new string[] { tags[r], tags[r2] };
r2 = rnd.Next(tags.Length); await client.Add(new Uri("http://" + url), tag);
tag = new string[] { tags[r], tags[r2] };
return client.Add(new Uri("http://" + url), tag);
}));
} }
} }
[Fact]
public async Task Fillll()
{
await FillAccount(11000, 89999);
}
} }
} }
+66
View File
@@ -168,6 +168,15 @@ namespace PocketSharp.Models
[JsonProperty("is_article")] [JsonProperty("is_article")]
public bool IsArticle { get; set; } public bool IsArticle { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance has image.
/// </summary>
/// <value>
/// <c>true</c> if this instance has image; otherwise, <c>false</c>.
/// </value>
[JsonProperty("has_image")]
private PocketBoolean? _HasImage { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether this instance has video. /// Gets or sets a value indicating whether this instance has video.
/// </summary> /// </summary>
@@ -177,6 +186,21 @@ namespace PocketSharp.Models
[JsonProperty("has_video")] [JsonProperty("has_video")]
private PocketBoolean? _HasVideo { get; set; } private PocketBoolean? _HasVideo { get; set; }
/// <summary>
/// Gets a value indicating whether [has image].
/// </summary>
/// <value>
/// <c>true</c> if [has image]; otherwise, <c>false</c>.
/// </value>
[JsonIgnore]
public bool HasImage
{
get
{
return _HasImage == PocketBoolean.Yes || _HasImage == PocketBoolean.IsType;
}
}
/// <summary> /// <summary>
/// Gets a value indicating whether [has video]. /// Gets a value indicating whether [has video].
/// </summary> /// </summary>
@@ -207,6 +231,21 @@ namespace PocketSharp.Models
} }
} }
/// <summary>
/// Gets a value indicating whether [is image].
/// </summary>
/// <value>
/// <c>true</c> if [is image]; otherwise, <c>false</c>.
/// </value>
[JsonIgnore]
public bool IsImage
{
get
{
return _HasImage == PocketBoolean.IsType;
}
}
/// <summary> /// <summary>
/// Gets or sets the word count. /// Gets or sets the word count.
/// </summary> /// </summary>
@@ -244,6 +283,24 @@ namespace PocketSharp.Models
[JsonProperty("time_updated")] [JsonProperty("time_updated")]
public DateTime? UpdateTime { get; set; } public DateTime? UpdateTime { get; set; }
/// <summary>
/// Gets or sets the read time.
/// </summary>
/// <value>
/// The read time.
/// </value>
[JsonProperty("time_read")]
public DateTime? ReadTime { get; set; }
/// <summary>
/// Gets or sets the favorite time.
/// </summary>
/// <value>
/// The favorite time.
/// </value>
[JsonProperty("time_favorited")]
public DateTime? FavoriteTime { get; set; }
/// <summary> /// <summary>
/// Gets or sets the tags as comma-separated strings. /// Gets or sets the tags as comma-separated strings.
/// </summary> /// </summary>
@@ -308,6 +365,15 @@ namespace PocketSharp.Models
get { return Images != null && Images.Count() > 0 ? Images.First() : null; } get { return Images != null && Images.Count() > 0 ? Images.First() : null; }
} }
/// <summary>
/// Gets and sets the JSON the model was deserialized from
/// </summary>
/// <value>
/// Model's original JSON representation
/// </value>
[JsonIgnore]
public string Json { get; set; }
/// <summary> /// <summary>
/// Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. /// Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
/// </summary> /// </summary>
+1 -1
View File
@@ -191,7 +191,7 @@ namespace PocketSharp
var jObject = JObject.ReadFrom(reader); var jObject = JObject.ReadFrom(reader);
var pocketItem = new PocketItem(); var pocketItem = new PocketItem();
serializer.Populate(jObject.CreateReader(), pocketItem); serializer.Populate(jObject.CreateReader(), pocketItem);
//pocketItem.Json = jObject.ToString(); pocketItem.Json = jObject.ToString();
return pocketItem; return pocketItem;
} }