-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathUnboundedIntegerIncrementPublisherTest.cs
41 lines (33 loc) · 1.22 KB
/
UnboundedIntegerIncrementPublisherTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections;
using System.Collections.Generic;
using Xunit;
using Xunit.Abstractions;
using Reactive.Streams.TCK;
namespace Reactive.Streams.Example.Unicast.Tests
{
[TestFixture]
public class UnboundedIntegerIncrementPublisherTest : PublisherVerification<int?>
{
public UnboundedIntegerIncrementPublisherTest() : base(new TestEnvironment())
{
}
public override IPublisher<int?> CreatePublisher(long elements) => new InfiniteIncrementNumberPublisher();
public override IPublisher<int?> CreateFailedPublisher() => new FailedPublisher();
private sealed class FailedPublisher : AsyncIterablePublisher<int?>
{
public FailedPublisher() : base(new FailedEnumerable())
{
}
private sealed class FailedEnumerable : IEnumerable<int?>
{
public IEnumerator<int?> GetEnumerator()
{
throw new Exception("Error state signal!");
}
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}
public override long MaxElementsFromPublisher => PublisherUnableToSignalOnComplete;
}
}