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);
}
// [Fact]
// public async Task IsItemJsonPopulated()
// {
// List<PocketItem> items = (await client.Get()).ToList();
// string schemaJson = @"{
// 'description': 'PocketItem',
// 'type': 'object'
// }";
[Fact]
public async Task IsItemJsonPopulated()
{
List<PocketItem> items = (await client.Get()).ToList();
string schemaJson = @"{
'description': 'PocketItem',
'type': 'object'
}";
// JsonSchema schema = JsonSchema.Parse(schemaJson);
// foreach (var pocketItem in items)
// {
// Assert.True(!string.IsNullOrWhiteSpace(pocketItem.Json));
// var jObject = JObject.Parse(pocketItem.Json);
// Assert.True(jObject.IsValid(schema));
// }
// }
JsonSchema schema = JsonSchema.Parse(schemaJson);
foreach (var pocketItem in items)
{
Assert.True(!string.IsNullOrWhiteSpace(pocketItem.Json));
var jObject = JObject.Parse(pocketItem.Json);
Assert.True(jObject.IsValid(schema));
}
}
[Fact]
public async Task AreFilteredItemsRetrieved()
+5 -19
View File
@@ -105,27 +105,13 @@ namespace PocketSharp.Tests
string[] tag;
Random rnd = new Random();
var items = 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)
foreach (string url in urls.Skip(offset).Take(count))
{
await Task.WhenAll(urlGroup.Select(url =>
{
r = rnd.Next(tags.Length);
r2 = rnd.Next(tags.Length);
tag = new string[] { tags[r], tags[r2] };
return client.Add(new Uri("http://" + url), tag);
}));
r = rnd.Next(tags.Length);
r2 = rnd.Next(tags.Length);
tag = new string[] { tags[r], tags[r2] };
await 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")]
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>
/// Gets or sets a value indicating whether this instance has video.
/// </summary>
@@ -177,6 +186,21 @@ namespace PocketSharp.Models
[JsonProperty("has_video")]
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>
/// Gets a value indicating whether [has video].
/// </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>
/// Gets or sets the word count.
/// </summary>
@@ -244,6 +283,24 @@ namespace PocketSharp.Models
[JsonProperty("time_updated")]
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>
/// Gets or sets the tags as comma-separated strings.
/// </summary>
@@ -308,6 +365,15 @@ namespace PocketSharp.Models
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>
/// 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>
+1 -1
View File
@@ -191,7 +191,7 @@ namespace PocketSharp
var jObject = JObject.ReadFrom(reader);
var pocketItem = new PocketItem();
serializer.Populate(jObject.CreateReader(), pocketItem);
//pocketItem.Json = jObject.ToString();
pocketItem.Json = jObject.ToString();
return pocketItem;
}