add stress tests

This commit is contained in:
2013-11-13 20:23:02 +01:00
parent ee989fc019
commit 0427399746
+58 -11
View File
@@ -1,4 +1,5 @@
using System;
using PocketSharp.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -23,38 +24,84 @@ namespace PocketSharp.Tests
accessCode: "9b8ecb6b-7801-1a5c-7b39-2ba05b"
);
urls = File.ReadAllLines("../../url-10000.csv").Select(item => item.Split(',')[1]);
urls = File.ReadAllLines("../../url-100000.csv").Select(item => item.Split(',')[1]);
}
[Fact]
public async Task Are100IdingtemsRetrievedProperly()
public async Task Are100ItemsRetrievedProperly()
{
await FillAccount(9273, 10000);
List<PocketItem> items = await client.Get(count: 100, state: State.all);
Assert.True(items.Count == 100);
}
[Fact]
public async Task Are1000ItemsRetrievedProperly()
{
List<PocketItem> items = await client.Get(count: 1000, state: State.all);
Assert.True(items.Count == 1000);
}
[Fact]
public async Task Are10000ItemsRetrievedProperly()
public async Task Are2500ItemsRetrievedProperly()
{
List<PocketItem> items = await client.Get(count: 2500, state: State.all);
Assert.True(items.Count == 2500);
}
[Fact]
public async Task Are0ItemsRetrievedProperly()
public async Task Are5000ItemsRetrievedProperly()
{
List<PocketItem> items = await client.Get(count: 5000, state: State.all);
Assert.True(items.Count == 5000);
}
[Fact]
public async Task IsSearchedSuccessfullyOn10000Items()
public async Task AreItemsRetrievedProperlyWithoutLimit()
{
List<PocketItem> items = await client.Get(state: State.all);
Assert.True(items.Count > 0);
}
[Fact]
public async Task IsSearchSuccessfullyOnBigList()
{
List<PocketItem> items = await client.Get(search: "google");
Assert.True(items.Count > 0);
Assert.True(items[0].FullTitle.ToLower().Contains("google"));
}
[Fact]
public async Task IsTagSearchSuccessfullyOnBigList()
{
List<PocketItem> items = await client.SearchByTag(tags[0]);
Assert.True(items.Count > 1);
bool found = false;
items[0].Tags.ForEach(tag =>
{
if (tag.Name.Contains(tags[0]))
{
found = true;
}
});
Assert.True(found);
}
[Fact]
public async Task RetrieveTagsReturnsResultOnBigList()
{
List<PocketTag> items = await client.GetTags();
items.ForEach(tag =>
{
Assert.True(tags.Contains(tag.Name));
});
Assert.Equal(items.Count, tags.Length);
}