This commit is contained in:
2014-07-02 15:31:38 +02:00
parent 01c36a047a
commit b7b92d87ed
4 changed files with 36 additions and 88 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()
+19 -5
View File
@@ -105,13 +105,27 @@ namespace PocketSharp.Tests
string[] tag;
Random rnd = new Random();
foreach (string url in urls.Skip(offset).Take(count))
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)
{
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);
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);
}));
}
}
[Fact]
public async Task Fillll()
{
await FillAccount(11000, 89999);
}
}
}