From 0427399746e323d12c8f432cc243fd3284857b11 Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Wed, 13 Nov 2013 20:23:02 +0100 Subject: [PATCH] add stress tests --- PocketSharp.Tests/StressTests.cs | 69 +++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/PocketSharp.Tests/StressTests.cs b/PocketSharp.Tests/StressTests.cs index d9667f9..c465331 100644 --- a/PocketSharp.Tests/StressTests.cs +++ b/PocketSharp.Tests/StressTests.cs @@ -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 items = await client.Get(count: 100, state: State.all); + Assert.True(items.Count == 100); } [Fact] public async Task Are1000ItemsRetrievedProperly() { - + List items = await client.Get(count: 1000, state: State.all); + Assert.True(items.Count == 1000); } [Fact] - public async Task Are10000ItemsRetrievedProperly() + public async Task Are2500ItemsRetrievedProperly() { - + List items = await client.Get(count: 2500, state: State.all); + Assert.True(items.Count == 2500); } [Fact] - public async Task Are0ItemsRetrievedProperly() + public async Task Are5000ItemsRetrievedProperly() { - + List items = await client.Get(count: 5000, state: State.all); + Assert.True(items.Count == 5000); } [Fact] - public async Task IsSearchedSuccessfullyOn10000Items() + public async Task AreItemsRetrievedProperlyWithoutLimit() { + List items = await client.Get(state: State.all); + Assert.True(items.Count > 0); + } + [Fact] + public async Task IsSearchSuccessfullyOnBigList() + { + List 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 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 items = await client.GetTags(); + + items.ForEach(tag => + { + Assert.True(tags.Contains(tag.Name)); + }); + + Assert.Equal(items.Count, tags.Length); }