|
1 | | -using NUnit.Framework; |
2 | | -using System; |
3 | | -using System.Collections.Generic; |
4 | | -using System.Linq; |
5 | | -using System.Text; |
6 | | -using System.Threading.Tasks; |
7 | | - |
8 | | -namespace stream_net_tests |
9 | | -{ |
10 | | - [Parallelizable(ParallelScope.None)] |
11 | | - [TestFixture] |
12 | | - public class BatchTests |
13 | | - { |
14 | | - private Stream.IStreamClient _client; |
15 | | - |
16 | | - [SetUp] |
17 | | - public void Setup() |
18 | | - { |
19 | | - _client = Credentials.Instance.Client; |
20 | | - } |
21 | | - |
22 | | - [Test] |
23 | | - |
24 | | - public void TestGetActivitiesArgumentValidation() |
25 | | - { |
26 | | - Assert.ThrowsAsync<ArgumentException>(async () => |
27 | | - { |
28 | | - var activities = await this._client.Batch.GetActivities(); |
29 | | - }); |
30 | | - Assert.ThrowsAsync<ArgumentException>(async () => |
31 | | - { |
32 | | - var activities = await this._client.Batch.GetActivities(new string[1], new Stream.ForeignIDTime[1]); |
33 | | - }); |
34 | | - } |
35 | | - |
36 | | - [Test] |
37 | | - |
38 | | - public void TestFollowManyArgumentValidation() |
39 | | - { |
40 | | - Assert.ThrowsAsync<ArgumentOutOfRangeException>(async () => |
41 | | - { |
42 | | - await this._client.Batch.FollowMany(null, -1); |
43 | | - }); |
44 | | - Assert.ThrowsAsync<ArgumentOutOfRangeException>(async () => |
45 | | - { |
46 | | - await this._client.Batch.FollowMany(null, 1001); |
47 | | - }); |
48 | | - Assert.DoesNotThrowAsync(async () => |
49 | | - { |
50 | | - await this._client.Batch.FollowMany(new Stream.Follow[] { new Stream.Follow("user:1", "user:2") }, 0); |
51 | | - }); |
52 | | - Assert.DoesNotThrowAsync(async () => |
53 | | - { |
54 | | - await this._client.Batch.FollowMany(new Stream.Follow[] { new Stream.Follow("user:1", "user:2") }, 1000); |
55 | | - }); |
56 | | - } |
57 | | - } |
58 | | -} |
| 1 | +using NUnit.Framework; |
| 2 | +using System; |
| 3 | +using System.Collections.Generic; |
| 4 | +using System.Linq; |
| 5 | +using System.Text; |
| 6 | +using System.Threading.Tasks; |
| 7 | + |
| 8 | +namespace stream_net_tests |
| 9 | +{ |
| 10 | + [Parallelizable(ParallelScope.None)] |
| 11 | + [TestFixture] |
| 12 | + public class BatchTests |
| 13 | + { |
| 14 | + private Stream.IStreamClient _client; |
| 15 | + |
| 16 | + [SetUp] |
| 17 | + public void Setup() |
| 18 | + { |
| 19 | + _client = Credentials.Instance.Client; |
| 20 | + } |
| 21 | + |
| 22 | + [Test] |
| 23 | + |
| 24 | + public void TestGetActivitiesArgumentValidation() |
| 25 | + { |
| 26 | + Assert.ThrowsAsync<ArgumentException>(async () => |
| 27 | + { |
| 28 | + var activities = await this._client.Batch.GetActivities(); |
| 29 | + }); |
| 30 | + Assert.ThrowsAsync<ArgumentException>(async () => |
| 31 | + { |
| 32 | + var activities = await this._client.Batch.GetActivities(new string[1], new Stream.ForeignIDTime[1]); |
| 33 | + }); |
| 34 | + } |
| 35 | + |
| 36 | + [Test] |
| 37 | + |
| 38 | + public void TestFollowManyArgumentValidation() |
| 39 | + { |
| 40 | + Assert.ThrowsAsync<ArgumentOutOfRangeException>(async () => |
| 41 | + { |
| 42 | + await this._client.Batch.FollowMany(null, -1); |
| 43 | + }); |
| 44 | + Assert.ThrowsAsync<ArgumentOutOfRangeException>(async () => |
| 45 | + { |
| 46 | + await this._client.Batch.FollowMany(null, 1001); |
| 47 | + }); |
| 48 | + Assert.DoesNotThrowAsync(async () => |
| 49 | + { |
| 50 | + await this._client.Batch.FollowMany(new Stream.Follow[] { new Stream.Follow("user:1", "user:2") }, 0); |
| 51 | + }); |
| 52 | + Assert.DoesNotThrowAsync(async () => |
| 53 | + { |
| 54 | + await this._client.Batch.FollowMany(new Stream.Follow[] { new Stream.Follow("user:1", "user:2") }, 1000); |
| 55 | + }); |
| 56 | + } |
| 57 | + } |
| 58 | +} |
0 commit comments