| 1 |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. |
| 2 |
|
| 3 |
using System; |
| 4 |
using System.Linq; |
| 5 |
using System.Reactive; |
| 6 |
using System.Reactive.Concurrency; |
| 7 |
using System.Reactive.Linq; |
| 8 |
using System.Threading; |
| 9 |
using Microsoft.Reactive.Testing; |
| 10 |
#if NUNIT |
| 11 |
using NUnit.Framework; |
| 12 |
using TestClassAttribute = NUnit.Framework.TestFixtureAttribute; |
| 13 |
using TestMethodAttribute = NUnit.Framework.TestAttribute; |
| 14 |
using TestInitializeAttribute = NUnit.Framework.SetUpAttribute; |
| 15 |
#else |
| 16 |
using Microsoft.VisualStudio.TestTools.UnitTesting; |
| 17 |
#endif |
| 18 |
|
| 19 |
#if !NO_TPL |
| 20 |
using System.Threading.Tasks; |
| 21 |
#endif |
| 22 |
|
| 23 |
namespace ReactiveTests.Tests |
| 24 |
{ |
| 25 |
[TestClass] |
| 26 |
public partial class ObservableAsyncTest : ReactiveTest |
| 27 |
{ |
| 28 |
#region FromAsyncPattern |
| 29 |
|
| 30 |
[TestMethod] |
| 31 |
public void FromAsyncPattern_ArgumentChecking() |
| 32 |
{ |
| 33 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern(null, iar => { })); |
| 34 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int>(null, iar => 0)); |
| 35 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int>(null, iar => { })); |
| 36 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int>(null, iar => 0)); |
| 37 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int>(null, iar => { })); |
| 38 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int>(null, iar => 0)); |
| 39 |
#if !NO_LARGEARITY |
| 40 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int>(null, iar => { })); |
| 41 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int>(null, iar => 0)); |
| 42 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int>(null, iar => { })); |
| 43 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int>(null, iar => 0)); |
| 44 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int>(null, iar => { })); |
| 45 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int>(null, iar => 0)); |
| 46 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int>(null, iar => { })); |
| 47 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int>(null, iar => 0)); |
| 48 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int>(null, iar => { })); |
| 49 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int>(null, iar => 0)); |
| 50 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int>(null, iar => { })); |
| 51 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int>(null, iar => 0)); |
| 52 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int>(null, iar => { })); |
| 53 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int>(null, iar => 0)); |
| 54 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int>(null, iar => { })); |
| 55 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int>(null, iar => 0)); |
| 56 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int>(null, iar => { })); |
| 57 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int>(null, iar => 0)); |
| 58 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int>(null, iar => { })); |
| 59 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int>(null, iar => 0)); |
| 60 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int>(null, iar => { })); |
| 61 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int, int>(null, iar => 0)); |
| 62 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int, int>(null, iar => { })); |
| 63 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(null, iar => 0)); |
| 64 |
#endif |
| 65 |
|
| 66 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern((cb, o) => null, default(Action<IAsyncResult>))); |
| 67 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int>((cb, o) => null, default(Func<IAsyncResult, int>))); |
| 68 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int>((a, cb, o) => null, default(Action<IAsyncResult>))); |
| 69 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int>((a, cb, o) => null, default(Func<IAsyncResult, int>))); |
| 70 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int>((a, b, cb, o) => null, default(Action<IAsyncResult>))); |
| 71 |
#if !NO_LARGEARITY |
| 72 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int>((a, b, cb, o) => null, default(Func<IAsyncResult, int>))); |
| 73 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int>((a, b, c, cb, o) => null, default(Action<IAsyncResult>))); |
| 74 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int>((a, b, c, cb, o) => null, default(Func<IAsyncResult, int>))); |
| 75 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int>((a, b, c, d, cb, o) => null, default(Action<IAsyncResult>))); |
| 76 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int>((a, b, c, d, cb, o) => null, default(Func<IAsyncResult, int>))); |
| 77 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int>((a, b, c, d, e, cb, o) => null, default(Action<IAsyncResult>))); |
| 78 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int>((a, b, c, d, e, cb, o) => null, default(Func<IAsyncResult, int>))); |
| 79 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int>((a, b, c, d, e, f, cb, o) => null, default(Action<IAsyncResult>))); |
| 80 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int>((a, b, c, d, e, f, cb, o) => null, default(Func<IAsyncResult, int>))); |
| 81 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int>((a, b, c, d, e, f, g, cb, o) => null, default(Action<IAsyncResult>))); |
| 82 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, cb, o) => null, default(Func<IAsyncResult, int>))); |
| 83 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, cb, o) => null, default(Action<IAsyncResult>))); |
| 84 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, cb, o) => null, default(Func<IAsyncResult, int>))); |
| 85 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, cb, o) => null, default(Action<IAsyncResult>))); |
| 86 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, cb, o) => null, default(Func<IAsyncResult, int>))); |
| 87 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, cb, o) => null, default(Action<IAsyncResult>))); |
| 88 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, cb, o) => null, default(Func<IAsyncResult, int>))); |
| 89 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, cb, o) => null, default(Action<IAsyncResult>))); |
| 90 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, cb, o) => null, default(Func<IAsyncResult, int>))); |
| 91 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, cb, o) => null, default(Action<IAsyncResult>))); |
| 92 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, cb, o) => null, default(Func<IAsyncResult, int>))); |
| 93 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, cb, o) => null, default(Action<IAsyncResult>))); |
| 94 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, cb, o) => null, default(Func<IAsyncResult, int>))); |
| 95 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, cb, o) => null, default(Action<IAsyncResult>))); |
| 96 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.FromAsyncPattern<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, cb, o) => null, default(Func<IAsyncResult, int>))); |
| 97 |
#endif |
| 98 |
} |
| 99 |
|
| 100 |
[TestMethod] |
| 101 |
public void FromAsyncPattern0() |
| 102 |
{ |
| 103 |
var x = new Result(); |
| 104 |
|
| 105 |
Func<AsyncCallback, object, IAsyncResult> begin = (cb, _) => { cb(x); return x; }; |
| 106 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 107 |
|
| 108 |
var res = Observable.FromAsyncPattern(begin, end)().Materialize().ToEnumerable().ToArray(); |
| 109 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 110 |
} |
| 111 |
|
| 112 |
[TestMethod] |
| 113 |
public void FromAsyncPatternAction0() |
| 114 |
{ |
| 115 |
var x = new Result(); |
| 116 |
|
| 117 |
Func<AsyncCallback, object, IAsyncResult> begin = (cb, _) => { cb(x); return x; }; |
| 118 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 119 |
|
| 120 |
var res = Observable.FromAsyncPattern(begin, end)().ToEnumerable().ToArray(); |
| 121 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 122 |
} |
| 123 |
|
| 124 |
[TestMethod] |
| 125 |
public void FromAsyncPattern0_Error() |
| 126 |
{ |
| 127 |
var x = new Result(); |
| 128 |
var ex = new Exception(); |
| 129 |
|
| 130 |
Func<AsyncCallback, object, IAsyncResult> begin = (cb, _) => { cb(x); return x; }; |
| 131 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 132 |
|
| 133 |
var res = Observable.FromAsyncPattern(begin, end)().Materialize().ToEnumerable().ToArray(); |
| 134 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 135 |
} |
| 136 |
|
| 137 |
[TestMethod] |
| 138 |
public void FromAsyncPattern0_ErrorBegin() |
| 139 |
{ |
| 140 |
var x = new Result(); |
| 141 |
var ex = new Exception(); |
| 142 |
|
| 143 |
Func<AsyncCallback, object, IAsyncResult> begin = (cb, _) => { cb(x); throw ex; }; |
| 144 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 145 |
|
| 146 |
var res = Observable.FromAsyncPattern(begin, end)().Materialize().ToEnumerable().ToArray(); |
| 147 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 148 |
} |
| 149 |
|
| 150 |
[TestMethod] |
| 151 |
public void FromAsyncPattern1() |
| 152 |
{ |
| 153 |
var x = new Result(); |
| 154 |
|
| 155 |
Func<int, AsyncCallback, object, IAsyncResult> begin = (a, cb, _) => |
| 156 |
{ |
| 157 |
Assert.AreEqual(a, 2); |
| 158 |
cb(x); |
| 159 |
return x; |
| 160 |
}; |
| 161 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 162 |
|
| 163 |
var res = Observable.FromAsyncPattern(begin, end)(2).Materialize().ToEnumerable().ToArray(); |
| 164 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 165 |
} |
| 166 |
|
| 167 |
[TestMethod] |
| 168 |
public void FromAsyncPatternAction1() |
| 169 |
{ |
| 170 |
var x = new Result(); |
| 171 |
|
| 172 |
Func<int, AsyncCallback, object, IAsyncResult> begin = (a, cb, _) => |
| 173 |
{ |
| 174 |
Assert.AreEqual(a, 2); |
| 175 |
cb(x); |
| 176 |
return x; |
| 177 |
}; |
| 178 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 179 |
|
| 180 |
var res = Observable.FromAsyncPattern(begin, end)(2).ToEnumerable().ToArray(); |
| 181 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 182 |
} |
| 183 |
|
| 184 |
[TestMethod] |
| 185 |
public void FromAsyncPattern1_Error() |
| 186 |
{ |
| 187 |
var x = new Result(); |
| 188 |
var ex = new Exception(); |
| 189 |
|
| 190 |
Func<int, AsyncCallback, object, IAsyncResult> begin = (a, cb, o) => { cb(x); return x; }; |
| 191 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 192 |
|
| 193 |
var res = Observable.FromAsyncPattern(begin, end)(2).Materialize().ToEnumerable().ToArray(); |
| 194 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 195 |
} |
| 196 |
|
| 197 |
[TestMethod] |
| 198 |
public void FromAsyncPattern1_ErrorBegin() |
| 199 |
{ |
| 200 |
var x = new Result(); |
| 201 |
var ex = new Exception(); |
| 202 |
|
| 203 |
Func<int, AsyncCallback, object, IAsyncResult> begin = (a, cb, o) => { cb(x); throw ex; }; |
| 204 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 205 |
|
| 206 |
var res = Observable.FromAsyncPattern(begin, end)(2).Materialize().ToEnumerable().ToArray(); |
| 207 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 208 |
} |
| 209 |
|
| 210 |
[TestMethod] |
| 211 |
public void FromAsyncPattern2() |
| 212 |
{ |
| 213 |
var x = new Result(); |
| 214 |
|
| 215 |
Func<int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, cb, _) => |
| 216 |
{ |
| 217 |
Assert.AreEqual(a, 2); |
| 218 |
Assert.AreEqual(b, 3); |
| 219 |
cb(x); |
| 220 |
return x; |
| 221 |
}; |
| 222 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 223 |
|
| 224 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3).Materialize().ToEnumerable().ToArray(); |
| 225 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 226 |
} |
| 227 |
|
| 228 |
[TestMethod] |
| 229 |
public void FromAsyncPatternAction2() |
| 230 |
{ |
| 231 |
var x = new Result(); |
| 232 |
|
| 233 |
Func<int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, cb, _) => |
| 234 |
{ |
| 235 |
Assert.AreEqual(a, 2); |
| 236 |
Assert.AreEqual(b, 3); |
| 237 |
cb(x); |
| 238 |
return x; |
| 239 |
}; |
| 240 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 241 |
|
| 242 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3).ToEnumerable().ToArray(); |
| 243 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 244 |
} |
| 245 |
|
| 246 |
[TestMethod] |
| 247 |
public void FromAsyncPattern2_Error() |
| 248 |
{ |
| 249 |
var x = new Result(); |
| 250 |
var ex = new Exception(); |
| 251 |
|
| 252 |
Func<int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, cb, o) => { cb(x); return x; }; |
| 253 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 254 |
|
| 255 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3).Materialize().ToEnumerable().ToArray(); |
| 256 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 257 |
} |
| 258 |
|
| 259 |
[TestMethod] |
| 260 |
public void FromAsyncPattern2_ErrorBegin() |
| 261 |
{ |
| 262 |
var x = new Result(); |
| 263 |
var ex = new Exception(); |
| 264 |
|
| 265 |
Func<int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, cb, o) => { cb(x); throw ex; }; |
| 266 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 267 |
|
| 268 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3).Materialize().ToEnumerable().ToArray(); |
| 269 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 270 |
} |
| 271 |
|
| 272 |
#if !NO_LARGEARITY |
| 273 |
[TestMethod] |
| 274 |
public void FromAsyncPattern3() |
| 275 |
{ |
| 276 |
var x = new Result(); |
| 277 |
|
| 278 |
Func<int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, cb, _) => |
| 279 |
{ |
| 280 |
Assert.AreEqual(a, 2); |
| 281 |
Assert.AreEqual(b, 3); |
| 282 |
Assert.AreEqual(c, 4); |
| 283 |
cb(x); |
| 284 |
return x; |
| 285 |
}; |
| 286 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 287 |
|
| 288 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4).Materialize().ToEnumerable().ToArray(); |
| 289 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 290 |
} |
| 291 |
[TestMethod] |
| 292 |
public void FromAsyncPatternAction3() |
| 293 |
{ |
| 294 |
var x = new Result(); |
| 295 |
|
| 296 |
Func<int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, cb, _) => |
| 297 |
{ |
| 298 |
Assert.AreEqual(a, 2); |
| 299 |
Assert.AreEqual(b, 3); |
| 300 |
Assert.AreEqual(c, 4); |
| 301 |
cb(x); |
| 302 |
return x; |
| 303 |
}; |
| 304 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 305 |
|
| 306 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4).ToEnumerable().ToArray(); |
| 307 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 308 |
} |
| 309 |
|
| 310 |
[TestMethod] |
| 311 |
public void FromAsyncPattern3_Error() |
| 312 |
{ |
| 313 |
var x = new Result(); |
| 314 |
var ex = new Exception(); |
| 315 |
|
| 316 |
Func<int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, cb, o) => { cb(x); return x; }; |
| 317 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 318 |
|
| 319 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4).Materialize().ToEnumerable().ToArray(); |
| 320 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 321 |
} |
| 322 |
|
| 323 |
[TestMethod] |
| 324 |
public void FromAsyncPattern3_ErrorBegin() |
| 325 |
{ |
| 326 |
var x = new Result(); |
| 327 |
var ex = new Exception(); |
| 328 |
|
| 329 |
Func<int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, cb, o) => { cb(x); throw ex; }; |
| 330 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 331 |
|
| 332 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4).Materialize().ToEnumerable().ToArray(); |
| 333 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 334 |
} |
| 335 |
|
| 336 |
[TestMethod] |
| 337 |
public void FromAsyncPattern4() |
| 338 |
{ |
| 339 |
var x = new Result(); |
| 340 |
|
| 341 |
Func<int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, cb, _) => |
| 342 |
{ |
| 343 |
Assert.AreEqual(a, 2); |
| 344 |
Assert.AreEqual(b, 3); |
| 345 |
Assert.AreEqual(c, 4); |
| 346 |
Assert.AreEqual(d, 5); |
| 347 |
cb(x); |
| 348 |
return x; |
| 349 |
}; |
| 350 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 351 |
|
| 352 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5).Materialize().ToEnumerable().ToArray(); |
| 353 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 354 |
} |
| 355 |
|
| 356 |
[TestMethod] |
| 357 |
public void FromAsyncPatternAction4() |
| 358 |
{ |
| 359 |
var x = new Result(); |
| 360 |
|
| 361 |
Func<int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, cb, _) => |
| 362 |
{ |
| 363 |
Assert.AreEqual(a, 2); |
| 364 |
Assert.AreEqual(b, 3); |
| 365 |
Assert.AreEqual(c, 4); |
| 366 |
Assert.AreEqual(d, 5); |
| 367 |
cb(x); |
| 368 |
return x; |
| 369 |
}; |
| 370 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 371 |
|
| 372 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5).ToEnumerable().ToArray(); |
| 373 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 374 |
} |
| 375 |
|
| 376 |
[TestMethod] |
| 377 |
public void FromAsyncPattern4_Error() |
| 378 |
{ |
| 379 |
var x = new Result(); |
| 380 |
var ex = new Exception(); |
| 381 |
|
| 382 |
Func<int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, cb, o) => { cb(x); return x; }; |
| 383 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 384 |
|
| 385 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5).Materialize().ToEnumerable().ToArray(); |
| 386 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 387 |
} |
| 388 |
|
| 389 |
[TestMethod] |
| 390 |
public void FromAsyncPattern4_ErrorBegin() |
| 391 |
{ |
| 392 |
var x = new Result(); |
| 393 |
var ex = new Exception(); |
| 394 |
|
| 395 |
Func<int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, cb, o) => { cb(x); throw ex; }; |
| 396 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 397 |
|
| 398 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5).Materialize().ToEnumerable().ToArray(); |
| 399 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 400 |
} |
| 401 |
|
| 402 |
[TestMethod] |
| 403 |
public void FromAsyncPattern5() |
| 404 |
{ |
| 405 |
var x = new Result(); |
| 406 |
|
| 407 |
Func<int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, cb, _) => |
| 408 |
{ |
| 409 |
Assert.AreEqual(a, 2); |
| 410 |
Assert.AreEqual(b, 3); |
| 411 |
Assert.AreEqual(c, 4); |
| 412 |
Assert.AreEqual(d, 5); |
| 413 |
Assert.AreEqual(e, 6); |
| 414 |
cb(x); |
| 415 |
return x; |
| 416 |
}; |
| 417 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 418 |
|
| 419 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6).Materialize().ToEnumerable().ToArray(); |
| 420 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 421 |
} |
| 422 |
|
| 423 |
[TestMethod] |
| 424 |
public void FromAsyncPatternAction5() |
| 425 |
{ |
| 426 |
var x = new Result(); |
| 427 |
|
| 428 |
Func<int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, cb, _) => |
| 429 |
{ |
| 430 |
Assert.AreEqual(a, 2); |
| 431 |
Assert.AreEqual(b, 3); |
| 432 |
Assert.AreEqual(c, 4); |
| 433 |
Assert.AreEqual(d, 5); |
| 434 |
Assert.AreEqual(e, 6); |
| 435 |
cb(x); |
| 436 |
return x; |
| 437 |
}; |
| 438 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 439 |
|
| 440 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6).ToEnumerable().ToArray(); |
| 441 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 442 |
} |
| 443 |
|
| 444 |
[TestMethod] |
| 445 |
public void FromAsyncPattern5_Error() |
| 446 |
{ |
| 447 |
var x = new Result(); |
| 448 |
var ex = new Exception(); |
| 449 |
|
| 450 |
Func<int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, cb, o) => { cb(x); return x; }; |
| 451 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 452 |
|
| 453 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6).Materialize().ToEnumerable().ToArray(); |
| 454 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 455 |
} |
| 456 |
|
| 457 |
[TestMethod] |
| 458 |
public void FromAsyncPattern5_ErrorBegin() |
| 459 |
{ |
| 460 |
var x = new Result(); |
| 461 |
var ex = new Exception(); |
| 462 |
|
| 463 |
Func<int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, cb, o) => { cb(x); throw ex; }; |
| 464 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 465 |
|
| 466 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6).Materialize().ToEnumerable().ToArray(); |
| 467 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 468 |
} |
| 469 |
|
| 470 |
[TestMethod] |
| 471 |
public void FromAsyncPattern6() |
| 472 |
{ |
| 473 |
var x = new Result(); |
| 474 |
|
| 475 |
Func<int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, cb, _) => |
| 476 |
{ |
| 477 |
Assert.AreEqual(a, 2); |
| 478 |
Assert.AreEqual(b, 3); |
| 479 |
Assert.AreEqual(c, 4); |
| 480 |
Assert.AreEqual(d, 5); |
| 481 |
Assert.AreEqual(e, 6); |
| 482 |
Assert.AreEqual(f, 7); |
| 483 |
cb(x); |
| 484 |
return x; |
| 485 |
}; |
| 486 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 487 |
|
| 488 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7).Materialize().ToEnumerable().ToArray(); |
| 489 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 490 |
} |
| 491 |
|
| 492 |
[TestMethod] |
| 493 |
public void FromAsyncPatternAction6() |
| 494 |
{ |
| 495 |
var x = new Result(); |
| 496 |
|
| 497 |
Func<int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, cb, _) => |
| 498 |
{ |
| 499 |
Assert.AreEqual(a, 2); |
| 500 |
Assert.AreEqual(b, 3); |
| 501 |
Assert.AreEqual(c, 4); |
| 502 |
Assert.AreEqual(d, 5); |
| 503 |
Assert.AreEqual(e, 6); |
| 504 |
Assert.AreEqual(f, 7); |
| 505 |
cb(x); |
| 506 |
return x; |
| 507 |
}; |
| 508 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 509 |
|
| 510 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7).ToEnumerable().ToArray(); |
| 511 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 512 |
} |
| 513 |
|
| 514 |
[TestMethod] |
| 515 |
public void FromAsyncPattern6_Error() |
| 516 |
{ |
| 517 |
var x = new Result(); |
| 518 |
var ex = new Exception(); |
| 519 |
|
| 520 |
Func<int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, cb, o) => { cb(x); return x; }; |
| 521 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 522 |
|
| 523 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7).Materialize().ToEnumerable().ToArray(); |
| 524 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 525 |
} |
| 526 |
|
| 527 |
[TestMethod] |
| 528 |
public void FromAsyncPattern6_ErrorBegin() |
| 529 |
{ |
| 530 |
var x = new Result(); |
| 531 |
var ex = new Exception(); |
| 532 |
|
| 533 |
Func<int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, cb, o) => { cb(x); throw ex; }; |
| 534 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 535 |
|
| 536 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7).Materialize().ToEnumerable().ToArray(); |
| 537 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 538 |
} |
| 539 |
|
| 540 |
[TestMethod] |
| 541 |
public void FromAsyncPattern7() |
| 542 |
{ |
| 543 |
var x = new Result(); |
| 544 |
|
| 545 |
Func<int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, cb, _) => |
| 546 |
{ |
| 547 |
Assert.AreEqual(a, 2); |
| 548 |
Assert.AreEqual(b, 3); |
| 549 |
Assert.AreEqual(c, 4); |
| 550 |
Assert.AreEqual(d, 5); |
| 551 |
Assert.AreEqual(e, 6); |
| 552 |
Assert.AreEqual(f, 7); |
| 553 |
Assert.AreEqual(g, 8); |
| 554 |
cb(x); |
| 555 |
return x; |
| 556 |
}; |
| 557 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 558 |
|
| 559 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8).Materialize().ToEnumerable().ToArray(); |
| 560 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 561 |
} |
| 562 |
|
| 563 |
[TestMethod] |
| 564 |
public void FromAsyncPatternAction7() |
| 565 |
{ |
| 566 |
var x = new Result(); |
| 567 |
|
| 568 |
Func<int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, cb, _) => |
| 569 |
{ |
| 570 |
Assert.AreEqual(a, 2); |
| 571 |
Assert.AreEqual(b, 3); |
| 572 |
Assert.AreEqual(c, 4); |
| 573 |
Assert.AreEqual(d, 5); |
| 574 |
Assert.AreEqual(e, 6); |
| 575 |
Assert.AreEqual(f, 7); |
| 576 |
Assert.AreEqual(g, 8); |
| 577 |
cb(x); |
| 578 |
return x; |
| 579 |
}; |
| 580 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 581 |
|
| 582 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8).ToEnumerable().ToArray(); |
| 583 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 584 |
} |
| 585 |
|
| 586 |
[TestMethod] |
| 587 |
public void FromAsyncPattern7_Error() |
| 588 |
{ |
| 589 |
var x = new Result(); |
| 590 |
var ex = new Exception(); |
| 591 |
|
| 592 |
Func<int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, cb, o) => { cb(x); return x; }; |
| 593 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 594 |
|
| 595 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8).Materialize().ToEnumerable().ToArray(); |
| 596 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 597 |
} |
| 598 |
|
| 599 |
[TestMethod] |
| 600 |
public void FromAsyncPattern7_ErrorBegin() |
| 601 |
{ |
| 602 |
var x = new Result(); |
| 603 |
var ex = new Exception(); |
| 604 |
|
| 605 |
Func<int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, cb, o) => { cb(x); throw ex; }; |
| 606 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 607 |
|
| 608 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8).Materialize().ToEnumerable().ToArray(); |
| 609 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 610 |
} |
| 611 |
|
| 612 |
[TestMethod] |
| 613 |
public void FromAsyncPattern8() |
| 614 |
{ |
| 615 |
var x = new Result(); |
| 616 |
|
| 617 |
Func<int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, cb, _) => |
| 618 |
{ |
| 619 |
Assert.AreEqual(a, 2); |
| 620 |
Assert.AreEqual(b, 3); |
| 621 |
Assert.AreEqual(c, 4); |
| 622 |
Assert.AreEqual(d, 5); |
| 623 |
Assert.AreEqual(e, 6); |
| 624 |
Assert.AreEqual(f, 7); |
| 625 |
Assert.AreEqual(g, 8); |
| 626 |
Assert.AreEqual(h, 9); |
| 627 |
cb(x); |
| 628 |
return x; |
| 629 |
}; |
| 630 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 631 |
|
| 632 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9).Materialize().ToEnumerable().ToArray(); |
| 633 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 634 |
} |
| 635 |
|
| 636 |
[TestMethod] |
| 637 |
public void FromAsyncPatternAction8() |
| 638 |
{ |
| 639 |
var x = new Result(); |
| 640 |
|
| 641 |
Func<int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, cb, _) => |
| 642 |
{ |
| 643 |
Assert.AreEqual(a, 2); |
| 644 |
Assert.AreEqual(b, 3); |
| 645 |
Assert.AreEqual(c, 4); |
| 646 |
Assert.AreEqual(d, 5); |
| 647 |
Assert.AreEqual(e, 6); |
| 648 |
Assert.AreEqual(f, 7); |
| 649 |
Assert.AreEqual(g, 8); |
| 650 |
Assert.AreEqual(h, 9); |
| 651 |
cb(x); |
| 652 |
return x; |
| 653 |
}; |
| 654 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 655 |
|
| 656 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9).ToEnumerable().ToArray(); |
| 657 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 658 |
} |
| 659 |
|
| 660 |
[TestMethod] |
| 661 |
public void FromAsyncPattern8_Error() |
| 662 |
{ |
| 663 |
var x = new Result(); |
| 664 |
var ex = new Exception(); |
| 665 |
|
| 666 |
Func<int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, cb, o) => { cb(x); return x; }; |
| 667 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 668 |
|
| 669 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9).Materialize().ToEnumerable().ToArray(); |
| 670 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 671 |
} |
| 672 |
|
| 673 |
[TestMethod] |
| 674 |
public void FromAsyncPattern8_ErrorBegin() |
| 675 |
{ |
| 676 |
var x = new Result(); |
| 677 |
var ex = new Exception(); |
| 678 |
|
| 679 |
Func<int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, cb, o) => { cb(x); throw ex; }; |
| 680 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 681 |
|
| 682 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9).Materialize().ToEnumerable().ToArray(); |
| 683 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 684 |
} |
| 685 |
|
| 686 |
[TestMethod] |
| 687 |
public void FromAsyncPattern9() |
| 688 |
{ |
| 689 |
var x = new Result(); |
| 690 |
|
| 691 |
Func<int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, cb, _) => |
| 692 |
{ |
| 693 |
Assert.AreEqual(a, 2); |
| 694 |
Assert.AreEqual(b, 3); |
| 695 |
Assert.AreEqual(c, 4); |
| 696 |
Assert.AreEqual(d, 5); |
| 697 |
Assert.AreEqual(e, 6); |
| 698 |
Assert.AreEqual(f, 7); |
| 699 |
Assert.AreEqual(g, 8); |
| 700 |
Assert.AreEqual(h, 9); |
| 701 |
Assert.AreEqual(i, 10); |
| 702 |
cb(x); |
| 703 |
return x; |
| 704 |
}; |
| 705 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 706 |
|
| 707 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10).Materialize().ToEnumerable().ToArray(); |
| 708 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 709 |
} |
| 710 |
|
| 711 |
[TestMethod] |
| 712 |
public void FromAsyncPatternAction9() |
| 713 |
{ |
| 714 |
var x = new Result(); |
| 715 |
|
| 716 |
Func<int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, cb, _) => |
| 717 |
{ |
| 718 |
Assert.AreEqual(a, 2); |
| 719 |
Assert.AreEqual(b, 3); |
| 720 |
Assert.AreEqual(c, 4); |
| 721 |
Assert.AreEqual(d, 5); |
| 722 |
Assert.AreEqual(e, 6); |
| 723 |
Assert.AreEqual(f, 7); |
| 724 |
Assert.AreEqual(g, 8); |
| 725 |
Assert.AreEqual(h, 9); |
| 726 |
Assert.AreEqual(i, 10); |
| 727 |
cb(x); |
| 728 |
return x; |
| 729 |
}; |
| 730 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 731 |
|
| 732 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10).ToEnumerable().ToArray(); |
| 733 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 734 |
} |
| 735 |
|
| 736 |
[TestMethod] |
| 737 |
public void FromAsyncPattern9_Error() |
| 738 |
{ |
| 739 |
var x = new Result(); |
| 740 |
var ex = new Exception(); |
| 741 |
|
| 742 |
Func<int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, cb, o) => { cb(x); return x; }; |
| 743 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 744 |
|
| 745 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10).Materialize().ToEnumerable().ToArray(); |
| 746 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 747 |
} |
| 748 |
|
| 749 |
[TestMethod] |
| 750 |
public void FromAsyncPattern9_ErrorBegin() |
| 751 |
{ |
| 752 |
var x = new Result(); |
| 753 |
var ex = new Exception(); |
| 754 |
|
| 755 |
Func<int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, cb, o) => { cb(x); throw ex; }; |
| 756 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 757 |
|
| 758 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10).Materialize().ToEnumerable().ToArray(); |
| 759 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 760 |
} |
| 761 |
|
| 762 |
[TestMethod] |
| 763 |
public void FromAsyncPattern10() |
| 764 |
{ |
| 765 |
var x = new Result(); |
| 766 |
|
| 767 |
Func<int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, cb, _) => |
| 768 |
{ |
| 769 |
Assert.AreEqual(a, 2); |
| 770 |
Assert.AreEqual(b, 3); |
| 771 |
Assert.AreEqual(c, 4); |
| 772 |
Assert.AreEqual(d, 5); |
| 773 |
Assert.AreEqual(e, 6); |
| 774 |
Assert.AreEqual(f, 7); |
| 775 |
Assert.AreEqual(g, 8); |
| 776 |
Assert.AreEqual(h, 9); |
| 777 |
Assert.AreEqual(i, 10); |
| 778 |
Assert.AreEqual(j, 11); |
| 779 |
cb(x); |
| 780 |
return x; |
| 781 |
}; |
| 782 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 783 |
|
| 784 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11).Materialize().ToEnumerable().ToArray(); |
| 785 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 786 |
} |
| 787 |
|
| 788 |
[TestMethod] |
| 789 |
public void FromAsyncPatternAction10() |
| 790 |
{ |
| 791 |
var x = new Result(); |
| 792 |
|
| 793 |
Func<int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, cb, _) => |
| 794 |
{ |
| 795 |
Assert.AreEqual(a, 2); |
| 796 |
Assert.AreEqual(b, 3); |
| 797 |
Assert.AreEqual(c, 4); |
| 798 |
Assert.AreEqual(d, 5); |
| 799 |
Assert.AreEqual(e, 6); |
| 800 |
Assert.AreEqual(f, 7); |
| 801 |
Assert.AreEqual(g, 8); |
| 802 |
Assert.AreEqual(h, 9); |
| 803 |
Assert.AreEqual(i, 10); |
| 804 |
Assert.AreEqual(j, 11); |
| 805 |
cb(x); |
| 806 |
return x; |
| 807 |
}; |
| 808 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 809 |
|
| 810 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11).ToEnumerable().ToArray(); |
| 811 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 812 |
} |
| 813 |
|
| 814 |
[TestMethod] |
| 815 |
public void FromAsyncPattern10_Error() |
| 816 |
{ |
| 817 |
var x = new Result(); |
| 818 |
var ex = new Exception(); |
| 819 |
|
| 820 |
Func<int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, cb, o) => { cb(x); return x; }; |
| 821 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 822 |
|
| 823 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11).Materialize().ToEnumerable().ToArray(); |
| 824 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 825 |
} |
| 826 |
|
| 827 |
[TestMethod] |
| 828 |
public void FromAsyncPattern10_ErrorBegin() |
| 829 |
{ |
| 830 |
var x = new Result(); |
| 831 |
var ex = new Exception(); |
| 832 |
|
| 833 |
Func<int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, cb, o) => { cb(x); throw ex; }; |
| 834 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 835 |
|
| 836 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11).Materialize().ToEnumerable().ToArray(); |
| 837 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 838 |
} |
| 839 |
|
| 840 |
[TestMethod] |
| 841 |
public void FromAsyncPattern11() |
| 842 |
{ |
| 843 |
var x = new Result(); |
| 844 |
|
| 845 |
Func<int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, cb, _) => |
| 846 |
{ |
| 847 |
Assert.AreEqual(a, 2); |
| 848 |
Assert.AreEqual(b, 3); |
| 849 |
Assert.AreEqual(c, 4); |
| 850 |
Assert.AreEqual(d, 5); |
| 851 |
Assert.AreEqual(e, 6); |
| 852 |
Assert.AreEqual(f, 7); |
| 853 |
Assert.AreEqual(g, 8); |
| 854 |
Assert.AreEqual(h, 9); |
| 855 |
Assert.AreEqual(i, 10); |
| 856 |
Assert.AreEqual(j, 11); |
| 857 |
Assert.AreEqual(k, 12); |
| 858 |
cb(x); |
| 859 |
return x; |
| 860 |
}; |
| 861 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 862 |
|
| 863 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).Materialize().ToEnumerable().ToArray(); |
| 864 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 865 |
} |
| 866 |
|
| 867 |
[TestMethod] |
| 868 |
public void FromAsyncPatternAction11() |
| 869 |
{ |
| 870 |
var x = new Result(); |
| 871 |
|
| 872 |
Func<int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, cb, _) => |
| 873 |
{ |
| 874 |
Assert.AreEqual(a, 2); |
| 875 |
Assert.AreEqual(b, 3); |
| 876 |
Assert.AreEqual(c, 4); |
| 877 |
Assert.AreEqual(d, 5); |
| 878 |
Assert.AreEqual(e, 6); |
| 879 |
Assert.AreEqual(f, 7); |
| 880 |
Assert.AreEqual(g, 8); |
| 881 |
Assert.AreEqual(h, 9); |
| 882 |
Assert.AreEqual(i, 10); |
| 883 |
Assert.AreEqual(j, 11); |
| 884 |
Assert.AreEqual(k, 12); |
| 885 |
cb(x); |
| 886 |
return x; |
| 887 |
}; |
| 888 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 889 |
|
| 890 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).ToEnumerable().ToArray(); |
| 891 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 892 |
} |
| 893 |
|
| 894 |
[TestMethod] |
| 895 |
public void FromAsyncPattern11_Error() |
| 896 |
{ |
| 897 |
var x = new Result(); |
| 898 |
var ex = new Exception(); |
| 899 |
|
| 900 |
Func<int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, cb, o) => { cb(x); return x; }; |
| 901 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 902 |
|
| 903 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).Materialize().ToEnumerable().ToArray(); |
| 904 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 905 |
} |
| 906 |
|
| 907 |
[TestMethod] |
| 908 |
public void FromAsyncPattern11_ErrorBegin() |
| 909 |
{ |
| 910 |
var x = new Result(); |
| 911 |
var ex = new Exception(); |
| 912 |
|
| 913 |
Func<int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, cb, o) => { cb(x); throw ex; }; |
| 914 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 915 |
|
| 916 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).Materialize().ToEnumerable().ToArray(); |
| 917 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 918 |
} |
| 919 |
|
| 920 |
[TestMethod] |
| 921 |
public void FromAsyncPattern12() |
| 922 |
{ |
| 923 |
var x = new Result(); |
| 924 |
|
| 925 |
Func<int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, cb, _) => |
| 926 |
{ |
| 927 |
Assert.AreEqual(a, 2); |
| 928 |
Assert.AreEqual(b, 3); |
| 929 |
Assert.AreEqual(c, 4); |
| 930 |
Assert.AreEqual(d, 5); |
| 931 |
Assert.AreEqual(e, 6); |
| 932 |
Assert.AreEqual(f, 7); |
| 933 |
Assert.AreEqual(g, 8); |
| 934 |
Assert.AreEqual(h, 9); |
| 935 |
Assert.AreEqual(i, 10); |
| 936 |
Assert.AreEqual(j, 11); |
| 937 |
Assert.AreEqual(k, 12); |
| 938 |
Assert.AreEqual(l, 13); |
| 939 |
cb(x); |
| 940 |
return x; |
| 941 |
}; |
| 942 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 943 |
|
| 944 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).Materialize().ToEnumerable().ToArray(); |
| 945 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 946 |
} |
| 947 |
|
| 948 |
[TestMethod] |
| 949 |
public void FromAsyncPatternAction12() |
| 950 |
{ |
| 951 |
var x = new Result(); |
| 952 |
|
| 953 |
Func<int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, cb, _) => |
| 954 |
{ |
| 955 |
Assert.AreEqual(a, 2); |
| 956 |
Assert.AreEqual(b, 3); |
| 957 |
Assert.AreEqual(c, 4); |
| 958 |
Assert.AreEqual(d, 5); |
| 959 |
Assert.AreEqual(e, 6); |
| 960 |
Assert.AreEqual(f, 7); |
| 961 |
Assert.AreEqual(g, 8); |
| 962 |
Assert.AreEqual(h, 9); |
| 963 |
Assert.AreEqual(i, 10); |
| 964 |
Assert.AreEqual(j, 11); |
| 965 |
Assert.AreEqual(k, 12); |
| 966 |
Assert.AreEqual(l, 13); |
| 967 |
cb(x); |
| 968 |
return x; |
| 969 |
}; |
| 970 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 971 |
|
| 972 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).ToEnumerable().ToArray(); |
| 973 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 974 |
} |
| 975 |
|
| 976 |
[TestMethod] |
| 977 |
public void FromAsyncPattern12_Error() |
| 978 |
{ |
| 979 |
var x = new Result(); |
| 980 |
var ex = new Exception(); |
| 981 |
|
| 982 |
Func<int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, cb, o) => { cb(x); return x; }; |
| 983 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 984 |
|
| 985 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).Materialize().ToEnumerable().ToArray(); |
| 986 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 987 |
} |
| 988 |
|
| 989 |
[TestMethod] |
| 990 |
public void FromAsyncPattern12_ErrorBegin() |
| 991 |
{ |
| 992 |
var x = new Result(); |
| 993 |
var ex = new Exception(); |
| 994 |
|
| 995 |
Func<int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, cb, o) => { cb(x); throw ex; }; |
| 996 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 997 |
|
| 998 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).Materialize().ToEnumerable().ToArray(); |
| 999 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 1000 |
} |
| 1001 |
|
| 1002 |
[TestMethod] |
| 1003 |
public void FromAsyncPattern13() |
| 1004 |
{ |
| 1005 |
var x = new Result(); |
| 1006 |
|
| 1007 |
Func<int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, cb, _) => |
| 1008 |
{ |
| 1009 |
Assert.AreEqual(a, 2); |
| 1010 |
Assert.AreEqual(b, 3); |
| 1011 |
Assert.AreEqual(c, 4); |
| 1012 |
Assert.AreEqual(d, 5); |
| 1013 |
Assert.AreEqual(e, 6); |
| 1014 |
Assert.AreEqual(f, 7); |
| 1015 |
Assert.AreEqual(g, 8); |
| 1016 |
Assert.AreEqual(h, 9); |
| 1017 |
Assert.AreEqual(i, 10); |
| 1018 |
Assert.AreEqual(j, 11); |
| 1019 |
Assert.AreEqual(k, 12); |
| 1020 |
Assert.AreEqual(l, 13); |
| 1021 |
Assert.AreEqual(m, 14); |
| 1022 |
cb(x); |
| 1023 |
return x; |
| 1024 |
}; |
| 1025 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 1026 |
|
| 1027 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).Materialize().ToEnumerable().ToArray(); |
| 1028 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 1029 |
} |
| 1030 |
|
| 1031 |
[TestMethod] |
| 1032 |
public void FromAsyncPatternAction13() |
| 1033 |
{ |
| 1034 |
var x = new Result(); |
| 1035 |
|
| 1036 |
Func<int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, cb, _) => |
| 1037 |
{ |
| 1038 |
Assert.AreEqual(a, 2); |
| 1039 |
Assert.AreEqual(b, 3); |
| 1040 |
Assert.AreEqual(c, 4); |
| 1041 |
Assert.AreEqual(d, 5); |
| 1042 |
Assert.AreEqual(e, 6); |
| 1043 |
Assert.AreEqual(f, 7); |
| 1044 |
Assert.AreEqual(g, 8); |
| 1045 |
Assert.AreEqual(h, 9); |
| 1046 |
Assert.AreEqual(i, 10); |
| 1047 |
Assert.AreEqual(j, 11); |
| 1048 |
Assert.AreEqual(k, 12); |
| 1049 |
Assert.AreEqual(l, 13); |
| 1050 |
Assert.AreEqual(m, 14); |
| 1051 |
cb(x); |
| 1052 |
return x; |
| 1053 |
}; |
| 1054 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 1055 |
|
| 1056 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).ToEnumerable().ToArray(); |
| 1057 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 1058 |
} |
| 1059 |
|
| 1060 |
[TestMethod] |
| 1061 |
public void FromAsyncPattern13_Error() |
| 1062 |
{ |
| 1063 |
var x = new Result(); |
| 1064 |
var ex = new Exception(); |
| 1065 |
|
| 1066 |
Func<int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, cb, o) => { cb(x); return x; }; |
| 1067 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 1068 |
|
| 1069 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).Materialize().ToEnumerable().ToArray(); |
| 1070 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 1071 |
} |
| 1072 |
|
| 1073 |
[TestMethod] |
| 1074 |
public void FromAsyncPattern13_ErrorBegin() |
| 1075 |
{ |
| 1076 |
var x = new Result(); |
| 1077 |
var ex = new Exception(); |
| 1078 |
|
| 1079 |
Func<int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, cb, o) => { cb(x); throw ex; }; |
| 1080 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 1081 |
|
| 1082 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).Materialize().ToEnumerable().ToArray(); |
| 1083 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 1084 |
} |
| 1085 |
|
| 1086 |
[TestMethod] |
| 1087 |
public void FromAsyncPattern14() |
| 1088 |
{ |
| 1089 |
var x = new Result(); |
| 1090 |
|
| 1091 |
Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, n, cb, _) => |
| 1092 |
{ |
| 1093 |
Assert.AreEqual(a, 2); |
| 1094 |
Assert.AreEqual(b, 3); |
| 1095 |
Assert.AreEqual(c, 4); |
| 1096 |
Assert.AreEqual(d, 5); |
| 1097 |
Assert.AreEqual(e, 6); |
| 1098 |
Assert.AreEqual(f, 7); |
| 1099 |
Assert.AreEqual(g, 8); |
| 1100 |
Assert.AreEqual(h, 9); |
| 1101 |
Assert.AreEqual(i, 10); |
| 1102 |
Assert.AreEqual(j, 11); |
| 1103 |
Assert.AreEqual(k, 12); |
| 1104 |
Assert.AreEqual(l, 13); |
| 1105 |
Assert.AreEqual(m, 14); |
| 1106 |
Assert.AreEqual(n, 15); |
| 1107 |
cb(x); |
| 1108 |
return x; |
| 1109 |
}; |
| 1110 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 1; }; |
| 1111 |
|
| 1112 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).Materialize().ToEnumerable().ToArray(); |
| 1113 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnNext<int>(1), Notification.CreateOnCompleted<int>() })); |
| 1114 |
} |
| 1115 |
|
| 1116 |
[TestMethod] |
| 1117 |
public void FromAsyncPatternAction14() |
| 1118 |
{ |
| 1119 |
var x = new Result(); |
| 1120 |
|
| 1121 |
Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, n, cb, _) => |
| 1122 |
{ |
| 1123 |
Assert.AreEqual(a, 2); |
| 1124 |
Assert.AreEqual(b, 3); |
| 1125 |
Assert.AreEqual(c, 4); |
| 1126 |
Assert.AreEqual(d, 5); |
| 1127 |
Assert.AreEqual(e, 6); |
| 1128 |
Assert.AreEqual(f, 7); |
| 1129 |
Assert.AreEqual(g, 8); |
| 1130 |
Assert.AreEqual(h, 9); |
| 1131 |
Assert.AreEqual(i, 10); |
| 1132 |
Assert.AreEqual(j, 11); |
| 1133 |
Assert.AreEqual(k, 12); |
| 1134 |
Assert.AreEqual(l, 13); |
| 1135 |
Assert.AreEqual(m, 14); |
| 1136 |
Assert.AreEqual(n, 15); |
| 1137 |
cb(x); |
| 1138 |
return x; |
| 1139 |
}; |
| 1140 |
Action<IAsyncResult> end = iar => { Assert.AreSame(x, iar); }; |
| 1141 |
|
| 1142 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).ToEnumerable().ToArray(); |
| 1143 |
Assert.IsTrue(res.SequenceEqual(new[] { new Unit() })); |
| 1144 |
} |
| 1145 |
|
| 1146 |
[TestMethod] |
| 1147 |
public void FromAsyncPattern14_Error() |
| 1148 |
{ |
| 1149 |
var x = new Result(); |
| 1150 |
var ex = new Exception(); |
| 1151 |
|
| 1152 |
Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, n, cb, o) => { cb(x); return x; }; |
| 1153 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); throw ex; }; |
| 1154 |
|
| 1155 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).Materialize().ToEnumerable().ToArray(); |
| 1156 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 1157 |
} |
| 1158 |
|
| 1159 |
[TestMethod] |
| 1160 |
public void FromAsyncPattern14_ErrorBegin() |
| 1161 |
{ |
| 1162 |
var x = new Result(); |
| 1163 |
var ex = new Exception(); |
| 1164 |
|
| 1165 |
Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, AsyncCallback, object, IAsyncResult> begin = (a, b, c, d, e, f, g, h, i, j, k, l, m, n, cb, o) => { cb(x); throw ex; }; |
| 1166 |
Func<IAsyncResult, int> end = iar => { Assert.AreSame(x, iar); return 0; }; |
| 1167 |
|
| 1168 |
var res = Observable.FromAsyncPattern(begin, end)(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).Materialize().ToEnumerable().ToArray(); |
| 1169 |
Assert.IsTrue(res.SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 1170 |
} |
| 1171 |
|
| 1172 |
#endif |
| 1173 |
class Result : IAsyncResult |
| 1174 |
{ |
| 1175 |
public object AsyncState |
| 1176 |
{ |
| 1177 |
get { throw new NotImplementedException(); } |
| 1178 |
} |
| 1179 |
|
| 1180 |
public System.Threading.WaitHandle AsyncWaitHandle |
| 1181 |
{ |
| 1182 |
get { throw new NotImplementedException(); } |
| 1183 |
} |
| 1184 |
|
| 1185 |
public bool CompletedSynchronously |
| 1186 |
{ |
| 1187 |
get { throw new NotImplementedException(); } |
| 1188 |
} |
| 1189 |
|
| 1190 |
public bool IsCompleted |
| 1191 |
{ |
| 1192 |
get { throw new NotImplementedException(); } |
| 1193 |
} |
| 1194 |
} |
| 1195 |
|
| 1196 |
#endregion |
| 1197 |
|
| 1198 |
#region Start |
| 1199 |
|
| 1200 |
[TestMethod] |
| 1201 |
public void Start_ArgumentChecking() |
| 1202 |
{ |
| 1203 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Start(null)); |
| 1204 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Start<int>((Func<int>)null)); |
| 1205 |
|
| 1206 |
var someScheduler = new TestScheduler(); |
| 1207 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Start(null, someScheduler)); |
| 1208 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Start<int>(null, someScheduler)); |
| 1209 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Start(() => { }, null)); |
| 1210 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Start<int>(() => 1, null)); |
| 1211 |
} |
| 1212 |
|
| 1213 |
|
| 1214 |
[TestMethod] |
| 1215 |
public void Start_Action() |
| 1216 |
{ |
| 1217 |
bool done = false; |
| 1218 |
Assert.IsTrue(Observable.Start(() => { done = true; }).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 1219 |
Assert.IsTrue(done, "done"); |
| 1220 |
} |
| 1221 |
|
| 1222 |
[TestMethod] |
| 1223 |
public void Start_Action2() |
| 1224 |
{ |
| 1225 |
var scheduler = new TestScheduler(); |
| 1226 |
|
| 1227 |
bool done = false; |
| 1228 |
|
| 1229 |
var res = scheduler.Start(() => |
| 1230 |
Observable.Start(() => { done = true; }, scheduler) |
| 1231 |
); |
| 1232 |
|
| 1233 |
res.Messages.AssertEqual( |
| 1234 |
OnNext(200, new Unit()), |
| 1235 |
OnCompleted<Unit>(200) |
| 1236 |
); |
| 1237 |
|
| 1238 |
Assert.IsTrue(done, "done"); |
| 1239 |
} |
| 1240 |
|
| 1241 |
[TestMethod] |
| 1242 |
public void Start_ActionError() |
| 1243 |
{ |
| 1244 |
var ex = new Exception(); |
| 1245 |
|
| 1246 |
var res = Observable.Start(() => { throw ex; }).Materialize().ToEnumerable(); |
| 1247 |
|
| 1248 |
Assert.IsTrue(res.SequenceEqual(new[] { |
| 1249 |
Notification.CreateOnError<Unit>(ex) |
| 1250 |
})); |
| 1251 |
} |
| 1252 |
|
| 1253 |
[TestMethod] |
| 1254 |
public void Start_Func() |
| 1255 |
{ |
| 1256 |
var res = Observable.Start(() => 1).ToEnumerable(); |
| 1257 |
|
| 1258 |
Assert.IsTrue(res.SequenceEqual(new[] { |
| 1259 |
1 |
| 1260 |
})); |
| 1261 |
} |
| 1262 |
|
| 1263 |
[TestMethod] |
| 1264 |
public void Start_Func2() |
| 1265 |
{ |
| 1266 |
var scheduler = new TestScheduler(); |
| 1267 |
|
| 1268 |
var res = scheduler.Start(() => |
| 1269 |
Observable.Start(() => 1, scheduler) |
| 1270 |
); |
| 1271 |
|
| 1272 |
res.Messages.AssertEqual( |
| 1273 |
OnNext(200, 1), |
| 1274 |
OnCompleted<int>(200) |
| 1275 |
); |
| 1276 |
} |
| 1277 |
|
| 1278 |
[TestMethod] |
| 1279 |
public void Start_FuncError() |
| 1280 |
{ |
| 1281 |
var ex = new Exception(); |
| 1282 |
|
| 1283 |
var res = Observable.Start<int>(() => { throw ex; }).Materialize().ToEnumerable(); |
| 1284 |
|
| 1285 |
Assert.IsTrue(res.SequenceEqual(new[] { |
| 1286 |
Notification.CreateOnError<int>(ex) |
| 1287 |
})); |
| 1288 |
} |
| 1289 |
|
| 1290 |
#endregion |
| 1291 |
|
| 1292 |
#region StartAsync |
| 1293 |
|
| 1294 |
#if !NO_TPL |
| 1295 |
|
| 1296 |
#region Func |
| 1297 |
|
| 1298 |
[TestMethod] |
| 1299 |
public void StartAsync_Func_ArgumentChecking() |
| 1300 |
{ |
| 1301 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.StartAsync<int>(default(Func<Task<int>>))); |
| 1302 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.StartAsync<int>(default(Func<CancellationToken, Task<int>>))); |
| 1303 |
} |
| 1304 |
|
| 1305 |
[TestMethod] |
| 1306 |
public void StartAsync_Func_Success() |
| 1307 |
{ |
| 1308 |
var n = 42; |
| 1309 |
|
| 1310 |
var i = 0; |
| 1311 |
|
| 1312 |
var xs = Observable.StartAsync(() => |
| 1313 |
{ |
| 1314 |
i++; |
| 1315 |
return Task.Factory.StartNew(() => n); |
| 1316 |
}); |
| 1317 |
|
| 1318 |
Assert.AreEqual(n, xs.Single()); |
| 1319 |
Assert.AreEqual(1, i); |
| 1320 |
|
| 1321 |
Assert.AreEqual(n, xs.Single()); |
| 1322 |
Assert.AreEqual(1, i); |
| 1323 |
} |
| 1324 |
|
| 1325 |
[TestMethod] |
| 1326 |
public void StartAsync_Func_Throw_Synchronous() |
| 1327 |
{ |
| 1328 |
var ex = new Exception(); |
| 1329 |
|
| 1330 |
var xs = Observable.StartAsync<int>(() => |
| 1331 |
{ |
| 1332 |
throw ex; |
| 1333 |
}); |
| 1334 |
|
| 1335 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1336 |
} |
| 1337 |
|
| 1338 |
[TestMethod] |
| 1339 |
public void StartAsync_Func_Throw_Asynchronous() |
| 1340 |
{ |
| 1341 |
var ex = new Exception(); |
| 1342 |
|
| 1343 |
var xs = Observable.StartAsync<int>(() => |
| 1344 |
Task.Factory.StartNew<int>(() => |
| 1345 |
{ |
| 1346 |
throw ex; |
| 1347 |
}) |
| 1348 |
); |
| 1349 |
|
| 1350 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1351 |
} |
| 1352 |
|
| 1353 |
[TestMethod] |
| 1354 |
public void StartAsync_FuncWithCancel_Success() |
| 1355 |
{ |
| 1356 |
var n = 42; |
| 1357 |
|
| 1358 |
var i = 0; |
| 1359 |
var xs = Observable.StartAsync(ct => |
| 1360 |
{ |
| 1361 |
i++; |
| 1362 |
return Task.Factory.StartNew(() => n); |
| 1363 |
}); |
| 1364 |
|
| 1365 |
Assert.AreEqual(n, xs.Single()); |
| 1366 |
Assert.AreEqual(1, i); |
| 1367 |
|
| 1368 |
Assert.AreEqual(n, xs.Single()); |
| 1369 |
Assert.AreEqual(1, i); |
| 1370 |
} |
| 1371 |
|
| 1372 |
[TestMethod] |
| 1373 |
public void StartAsync_FuncWithCancel_Throw_Synchronous() |
| 1374 |
{ |
| 1375 |
var ex = new Exception(); |
| 1376 |
|
| 1377 |
var xs = Observable.StartAsync<int>(ct => |
| 1378 |
{ |
| 1379 |
throw ex; |
| 1380 |
}); |
| 1381 |
|
| 1382 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1383 |
} |
| 1384 |
|
| 1385 |
[TestMethod] |
| 1386 |
public void StartAsync_FuncWithCancel_Throw_Asynchronous() |
| 1387 |
{ |
| 1388 |
var ex = new Exception(); |
| 1389 |
|
| 1390 |
var xs = Observable.StartAsync<int>(ct => |
| 1391 |
Task.Factory.StartNew<int>(() => { throw ex; }) |
| 1392 |
); |
| 1393 |
|
| 1394 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1395 |
} |
| 1396 |
|
| 1397 |
[TestMethod] |
| 1398 |
public void StartAsync_FuncWithCancel_Cancel() |
| 1399 |
{ |
| 1400 |
var N = 10; |
| 1401 |
|
| 1402 |
for (int n = 0; n < N; n++) |
| 1403 |
{ |
| 1404 |
var e = new ManualResetEvent(false); |
| 1405 |
var f = new ManualResetEvent(false); |
| 1406 |
|
| 1407 |
var t = default(Task<int>); |
| 1408 |
var xs = Observable.StartAsync(ct => |
| 1409 |
t = Task.Factory.StartNew<int>(() => |
| 1410 |
{ |
| 1411 |
try |
| 1412 |
{ |
| 1413 |
e.Set(); |
| 1414 |
while (true) |
| 1415 |
ct.ThrowIfCancellationRequested(); |
| 1416 |
} |
| 1417 |
finally |
| 1418 |
{ |
| 1419 |
f.Set(); |
| 1420 |
} |
| 1421 |
}) |
| 1422 |
); |
| 1423 |
|
| 1424 |
e.WaitOne(); |
| 1425 |
|
| 1426 |
var d = xs.Subscribe(_ => { }); |
| 1427 |
d.Dispose(); |
| 1428 |
|
| 1429 |
f.WaitOne(); |
| 1430 |
while (!t.IsCompleted) |
| 1431 |
; |
| 1432 |
|
| 1433 |
ReactiveAssert.Throws<OperationCanceledException>(() => xs.Single()); |
| 1434 |
} |
| 1435 |
} |
| 1436 |
|
| 1437 |
#endregion |
| 1438 |
|
| 1439 |
#region Action |
| 1440 |
|
| 1441 |
[TestMethod] |
| 1442 |
public void StartAsync_Action_ArgumentChecking() |
| 1443 |
{ |
| 1444 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.StartAsync(default(Func<Task>))); |
| 1445 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.StartAsync(default(Func<CancellationToken, Task>))); |
| 1446 |
} |
| 1447 |
|
| 1448 |
[TestMethod] |
| 1449 |
public void StartAsync_Action_Success() |
| 1450 |
{ |
| 1451 |
var i = 0; |
| 1452 |
var xs = Observable.StartAsync(() => |
| 1453 |
{ |
| 1454 |
i++; |
| 1455 |
return Task.Factory.StartNew(() => { }); |
| 1456 |
}); |
| 1457 |
|
| 1458 |
Assert.AreEqual(Unit.Default, xs.Single()); |
| 1459 |
Assert.AreEqual(1, i); |
| 1460 |
|
| 1461 |
Assert.AreEqual(Unit.Default, xs.Single()); |
| 1462 |
Assert.AreEqual(1, i); |
| 1463 |
} |
| 1464 |
|
| 1465 |
[TestMethod] |
| 1466 |
public void StartAsync_Action_Throw_Synchronous() |
| 1467 |
{ |
| 1468 |
var ex = new Exception(); |
| 1469 |
|
| 1470 |
var xs = Observable.StartAsync(() => |
| 1471 |
{ |
| 1472 |
throw ex; |
| 1473 |
}); |
| 1474 |
|
| 1475 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1476 |
} |
| 1477 |
|
| 1478 |
[TestMethod] |
| 1479 |
public void StartAsync_Action_Throw_Asynchronous() |
| 1480 |
{ |
| 1481 |
var ex = new Exception(); |
| 1482 |
|
| 1483 |
var xs = Observable.StartAsync(() => |
| 1484 |
Task.Factory.StartNew(() => { throw ex; }) |
| 1485 |
); |
| 1486 |
|
| 1487 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1488 |
} |
| 1489 |
|
| 1490 |
[TestMethod] |
| 1491 |
public void StartAsync_ActionWithCancel_Success() |
| 1492 |
{ |
| 1493 |
var i = 0; |
| 1494 |
var xs = Observable.StartAsync(ct => |
| 1495 |
{ |
| 1496 |
i++; |
| 1497 |
return Task.Factory.StartNew(() => { }); |
| 1498 |
}); |
| 1499 |
|
| 1500 |
Assert.AreEqual(Unit.Default, xs.Single()); |
| 1501 |
Assert.AreEqual(1, i); |
| 1502 |
|
| 1503 |
Assert.AreEqual(Unit.Default, xs.Single()); |
| 1504 |
Assert.AreEqual(1, i); |
| 1505 |
} |
| 1506 |
|
| 1507 |
[TestMethod] |
| 1508 |
public void StartAsync_ActionWithCancel_Throw_Synchronous() |
| 1509 |
{ |
| 1510 |
var ex = new Exception(); |
| 1511 |
|
| 1512 |
var xs = Observable.StartAsync(ct => |
| 1513 |
{ |
| 1514 |
throw ex; |
| 1515 |
}); |
| 1516 |
|
| 1517 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1518 |
} |
| 1519 |
|
| 1520 |
[TestMethod] |
| 1521 |
public void StartAsync_ActionWithCancel_Throw_Asynchronous() |
| 1522 |
{ |
| 1523 |
var ex = new Exception(); |
| 1524 |
|
| 1525 |
var xs = Observable.StartAsync(ct => |
| 1526 |
Task.Factory.StartNew(() => { throw ex; }) |
| 1527 |
); |
| 1528 |
|
| 1529 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1530 |
} |
| 1531 |
|
| 1532 |
[TestMethod] |
| 1533 |
public void StartAsync_ActionWithCancel_Cancel() |
| 1534 |
{ |
| 1535 |
var N = 10; |
| 1536 |
|
| 1537 |
for (int n = 0; n < N; n++) |
| 1538 |
{ |
| 1539 |
var e = new ManualResetEvent(false); |
| 1540 |
var f = new ManualResetEvent(false); |
| 1541 |
|
| 1542 |
var t = default(Task); |
| 1543 |
var xs = Observable.StartAsync(ct => |
| 1544 |
t = Task.Factory.StartNew(() => |
| 1545 |
{ |
| 1546 |
try |
| 1547 |
{ |
| 1548 |
e.Set(); |
| 1549 |
while (true) |
| 1550 |
ct.ThrowIfCancellationRequested(); |
| 1551 |
} |
| 1552 |
finally |
| 1553 |
{ |
| 1554 |
f.Set(); |
| 1555 |
} |
| 1556 |
}) |
| 1557 |
); |
| 1558 |
|
| 1559 |
e.WaitOne(); |
| 1560 |
|
| 1561 |
var d = xs.Subscribe(_ => { }); |
| 1562 |
d.Dispose(); |
| 1563 |
|
| 1564 |
f.WaitOne(); |
| 1565 |
while (!t.IsCompleted) |
| 1566 |
; |
| 1567 |
|
| 1568 |
ReactiveAssert.Throws<OperationCanceledException>(() => xs.Single()); |
| 1569 |
} |
| 1570 |
} |
| 1571 |
|
| 1572 |
#endregion |
| 1573 |
|
| 1574 |
#endif |
| 1575 |
|
| 1576 |
#endregion |
| 1577 |
|
| 1578 |
#region FromAsync |
| 1579 |
|
| 1580 |
#if !NO_TPL |
| 1581 |
|
| 1582 |
#region Func |
| 1583 |
|
| 1584 |
[TestMethod] |
| 1585 |
public void FromAsync_Func_Success() |
| 1586 |
{ |
| 1587 |
var n = 42; |
| 1588 |
|
| 1589 |
var i = 0; |
| 1590 |
var xs = Observable.FromAsync(() => |
| 1591 |
{ |
| 1592 |
i++; |
| 1593 |
return Task.Factory.StartNew(() => n); |
| 1594 |
}); |
| 1595 |
|
| 1596 |
Assert.AreEqual(n, xs.Single()); |
| 1597 |
Assert.AreEqual(1, i); |
| 1598 |
|
| 1599 |
Assert.AreEqual(n, xs.Single()); |
| 1600 |
Assert.AreEqual(2, i); |
| 1601 |
} |
| 1602 |
|
| 1603 |
[TestMethod] |
| 1604 |
public void FromAsync_Func_Throw_Synchronous() |
| 1605 |
{ |
| 1606 |
var ex = new Exception(); |
| 1607 |
|
| 1608 |
var xs = Observable.FromAsync<int>(() => |
| 1609 |
{ |
| 1610 |
throw ex; |
| 1611 |
}); |
| 1612 |
|
| 1613 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1614 |
} |
| 1615 |
|
| 1616 |
[TestMethod] |
| 1617 |
public void FromAsync_Func_Throw_Asynchronous() |
| 1618 |
{ |
| 1619 |
var ex = new Exception(); |
| 1620 |
|
| 1621 |
var xs = Observable.FromAsync<int>(() => |
| 1622 |
Task.Factory.StartNew<int>(() => { throw ex; }) |
| 1623 |
); |
| 1624 |
|
| 1625 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1626 |
} |
| 1627 |
|
| 1628 |
[TestMethod] |
| 1629 |
public void FromAsync_FuncWithCancel_Success() |
| 1630 |
{ |
| 1631 |
var n = 42; |
| 1632 |
|
| 1633 |
var i = 0; |
| 1634 |
var xs = Observable.FromAsync(ct => |
| 1635 |
{ |
| 1636 |
i++; |
| 1637 |
return Task.Factory.StartNew(() => n); |
| 1638 |
}); |
| 1639 |
|
| 1640 |
Assert.AreEqual(n, xs.Single()); |
| 1641 |
Assert.AreEqual(1, i); |
| 1642 |
|
| 1643 |
Assert.AreEqual(n, xs.Single()); |
| 1644 |
Assert.AreEqual(2, i); |
| 1645 |
} |
| 1646 |
|
| 1647 |
[TestMethod] |
| 1648 |
public void FromAsync_FuncWithCancel_Throw_Synchronous() |
| 1649 |
{ |
| 1650 |
var ex = new Exception(); |
| 1651 |
|
| 1652 |
var xs = Observable.FromAsync<int>(ct => |
| 1653 |
{ |
| 1654 |
throw ex; |
| 1655 |
}); |
| 1656 |
|
| 1657 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1658 |
} |
| 1659 |
|
| 1660 |
[TestMethod] |
| 1661 |
public void FromAsync_FuncWithCancel_Throw_Asynchronous() |
| 1662 |
{ |
| 1663 |
var ex = new Exception(); |
| 1664 |
|
| 1665 |
var xs = Observable.FromAsync<int>(ct => |
| 1666 |
Task.Factory.StartNew<int>(() => { throw ex; }) |
| 1667 |
); |
| 1668 |
|
| 1669 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1670 |
} |
| 1671 |
|
| 1672 |
[TestMethod] |
| 1673 |
public void FromAsync_FuncWithCancel_Cancel() |
| 1674 |
{ |
| 1675 |
var e = new ManualResetEvent(false); |
| 1676 |
var f = new ManualResetEvent(false); |
| 1677 |
|
| 1678 |
var t = default(Task<int>); |
| 1679 |
var xs = Observable.FromAsync(ct => |
| 1680 |
t = Task.Factory.StartNew<int>(() => |
| 1681 |
{ |
| 1682 |
try |
| 1683 |
{ |
| 1684 |
e.Set(); |
| 1685 |
while (true) |
| 1686 |
ct.ThrowIfCancellationRequested(); |
| 1687 |
} |
| 1688 |
finally |
| 1689 |
{ |
| 1690 |
f.Set(); |
| 1691 |
} |
| 1692 |
}) |
| 1693 |
); |
| 1694 |
|
| 1695 |
var d = xs.Subscribe(_ => { }); |
| 1696 |
e.WaitOne(); |
| 1697 |
d.Dispose(); |
| 1698 |
|
| 1699 |
f.WaitOne(); |
| 1700 |
while (!t.IsCompleted) |
| 1701 |
; |
| 1702 |
} |
| 1703 |
|
| 1704 |
#endregion |
| 1705 |
|
| 1706 |
#region Action |
| 1707 |
|
| 1708 |
[TestMethod] |
| 1709 |
public void FromAsync_Action_Success() |
| 1710 |
{ |
| 1711 |
var i = 0; |
| 1712 |
var xs = Observable.FromAsync(() => |
| 1713 |
{ |
| 1714 |
i++; |
| 1715 |
return Task.Factory.StartNew(() => { }); |
| 1716 |
}); |
| 1717 |
|
| 1718 |
Assert.AreEqual(Unit.Default, xs.Single()); |
| 1719 |
Assert.AreEqual(1, i); |
| 1720 |
|
| 1721 |
Assert.AreEqual(Unit.Default, xs.Single()); |
| 1722 |
Assert.AreEqual(2, i); |
| 1723 |
} |
| 1724 |
|
| 1725 |
[TestMethod] |
| 1726 |
public void FromAsync_Action_Throw_Synchronous() |
| 1727 |
{ |
| 1728 |
var ex = new Exception(); |
| 1729 |
|
| 1730 |
var xs = Observable.FromAsync(() => |
| 1731 |
{ |
| 1732 |
throw ex; |
| 1733 |
}); |
| 1734 |
|
| 1735 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1736 |
} |
| 1737 |
|
| 1738 |
[TestMethod] |
| 1739 |
public void FromAsync_Action_Throw_Asynchronous() |
| 1740 |
{ |
| 1741 |
var ex = new Exception(); |
| 1742 |
|
| 1743 |
var xs = Observable.FromAsync(() => |
| 1744 |
Task.Factory.StartNew(() => { throw ex; }) |
| 1745 |
); |
| 1746 |
|
| 1747 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1748 |
} |
| 1749 |
|
| 1750 |
[TestMethod] |
| 1751 |
public void FromAsync_ActionWithCancel_Success() |
| 1752 |
{ |
| 1753 |
var i = 0; |
| 1754 |
var xs = Observable.FromAsync(ct => |
| 1755 |
{ |
| 1756 |
i++; |
| 1757 |
return Task.Factory.StartNew(() => { }); |
| 1758 |
}); |
| 1759 |
|
| 1760 |
Assert.AreEqual(Unit.Default, xs.Single()); |
| 1761 |
Assert.AreEqual(1, i); |
| 1762 |
|
| 1763 |
Assert.AreEqual(Unit.Default, xs.Single()); |
| 1764 |
Assert.AreEqual(2, i); |
| 1765 |
} |
| 1766 |
|
| 1767 |
[TestMethod] |
| 1768 |
public void FromAsync_ActionWithCancel_Throw_Synchronous() |
| 1769 |
{ |
| 1770 |
var ex = new Exception(); |
| 1771 |
|
| 1772 |
var xs = Observable.FromAsync(ct => |
| 1773 |
{ |
| 1774 |
throw ex; |
| 1775 |
}); |
| 1776 |
|
| 1777 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1778 |
} |
| 1779 |
|
| 1780 |
[TestMethod] |
| 1781 |
public void FromAsync_ActionWithCancel_Throw_Asynchronous() |
| 1782 |
{ |
| 1783 |
var ex = new Exception(); |
| 1784 |
|
| 1785 |
var xs = Observable.FromAsync(ct => |
| 1786 |
Task.Factory.StartNew(() => { throw ex; }) |
| 1787 |
); |
| 1788 |
|
| 1789 |
ReactiveAssert.Throws(ex, () => xs.Single()); |
| 1790 |
} |
| 1791 |
|
| 1792 |
[TestMethod] |
| 1793 |
public void FromAsync_ActionWithCancel_Cancel() |
| 1794 |
{ |
| 1795 |
var e = new ManualResetEvent(false); |
| 1796 |
var f = new ManualResetEvent(false); |
| 1797 |
|
| 1798 |
var t = default(Task); |
| 1799 |
var xs = Observable.FromAsync(ct => |
| 1800 |
t = Task.Factory.StartNew(() => |
| 1801 |
{ |
| 1802 |
try |
| 1803 |
{ |
| 1804 |
e.Set(); |
| 1805 |
while (true) |
| 1806 |
ct.ThrowIfCancellationRequested(); |
| 1807 |
} |
| 1808 |
finally |
| 1809 |
{ |
| 1810 |
f.Set(); |
| 1811 |
} |
| 1812 |
}) |
| 1813 |
); |
| 1814 |
|
| 1815 |
var d = xs.Subscribe(_ => { }); |
| 1816 |
e.WaitOne(); |
| 1817 |
d.Dispose(); |
| 1818 |
|
| 1819 |
f.WaitOne(); |
| 1820 |
while (!t.IsCompleted) |
| 1821 |
; |
| 1822 |
} |
| 1823 |
|
| 1824 |
#endregion |
| 1825 |
|
| 1826 |
#endif |
| 1827 |
|
| 1828 |
#endregion |
| 1829 |
|
| 1830 |
#region ToAsync |
| 1831 |
|
| 1832 |
[TestMethod] |
| 1833 |
public void ToAsync_ArgumentChecking() |
| 1834 |
{ |
| 1835 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync(default(Action))); |
| 1836 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int>(default(Action<int>))); |
| 1837 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int>(default(Func<int>))); |
| 1838 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int>(default(Action<int, int>))); |
| 1839 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int>(default(Func<int, int>))); |
| 1840 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int>(default(Action<int, int, int>))); |
| 1841 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int>(default(Func<int, int, int>))); |
| 1842 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int>(default(Action<int, int, int, int>))); |
| 1843 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int>(default(Func<int, int, int, int>))); |
| 1844 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int>(default(Func<int, int, int, int, int>))); |
| 1845 |
#if !NO_LARGEARITY |
| 1846 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int>(default(Action<int, int, int, int, int>))); |
| 1847 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int>(default(Action<int, int, int, int, int, int>))); |
| 1848 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int>(default(Func<int, int, int, int, int, int>))); |
| 1849 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int>))); |
| 1850 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int>))); |
| 1851 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int>))); |
| 1852 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int>))); |
| 1853 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int>))); |
| 1854 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int>))); |
| 1855 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int>))); |
| 1856 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int>))); |
| 1857 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int>))); |
| 1858 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int>))); |
| 1859 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int>))); |
| 1860 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int>))); |
| 1861 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int>))); |
| 1862 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int>))); |
| 1863 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int, int>))); |
| 1864 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int>))); |
| 1865 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>))); |
| 1866 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>))); |
| 1867 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>))); |
| 1868 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>))); |
| 1869 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>))); |
| 1870 |
#endif |
| 1871 |
var someScheduler = new TestScheduler(); |
| 1872 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync(default(Action), someScheduler)); |
| 1873 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int>(default(Action<int>), someScheduler)); |
| 1874 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int>(default(Func<int>), someScheduler)); |
| 1875 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int>(default(Action<int, int>), someScheduler)); |
| 1876 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int>(default(Func<int, int>), someScheduler)); |
| 1877 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int>(default(Action<int, int, int>), someScheduler)); |
| 1878 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int>(default(Func<int, int, int>), someScheduler)); |
| 1879 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int>(default(Action<int, int, int, int>), someScheduler)); |
| 1880 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int>(default(Func<int, int, int, int>), someScheduler)); |
| 1881 |
#if !NO_LARGEARITY |
| 1882 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int>(default(Func<int, int, int, int, int>), someScheduler)); |
| 1883 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int>(default(Action<int, int, int, int, int>), someScheduler)); |
| 1884 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int>(default(Action<int, int, int, int, int, int>), someScheduler)); |
| 1885 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int>(default(Func<int, int, int, int, int, int>), someScheduler)); |
| 1886 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int>), someScheduler)); |
| 1887 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int>), someScheduler)); |
| 1888 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int>), someScheduler)); |
| 1889 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int>), someScheduler)); |
| 1890 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1891 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1892 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1893 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1894 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1895 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1896 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1897 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1898 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1899 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1900 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1901 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1902 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1903 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1904 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Action<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1905 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1906 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(default(Func<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>), someScheduler)); |
| 1907 |
#endif |
| 1908 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync(() => { }, null)); |
| 1909 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int>(a => { }, null)); |
| 1910 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int>(() => 1, null)); |
| 1911 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int>((a, b) => { }, null)); |
| 1912 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int>(a => 1, null)); |
| 1913 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int>((a, b, c) => { }, null)); |
| 1914 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int>((a, b) => 1, null)); |
| 1915 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int>((a, b, c, d) => { }, null)); |
| 1916 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int>((a, b, c) => 1, null)); |
| 1917 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int>((a, b, c, d) => 1, null)); |
| 1918 |
#if !NO_LARGEARITY |
| 1919 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int>((a, b, c, d, e) => { }, null)); |
| 1920 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e, f) => { }, null)); |
| 1921 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e) => 1, null)); |
| 1922 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => { }, null)); |
| 1923 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f) => 1, null)); |
| 1924 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => { }, null)); |
| 1925 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => 1, null)); |
| 1926 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => { }, null)); |
| 1927 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => 1, null)); |
| 1928 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => { }, null)); |
| 1929 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => 1, null)); |
| 1930 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => { }, null)); |
| 1931 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => 1, null)); |
| 1932 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => { }, null)); |
| 1933 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => 1, null)); |
| 1934 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => { }, null)); |
| 1935 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => 1, null)); |
| 1936 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => { }, null)); |
| 1937 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => 1, null)); |
| 1938 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => { }, null)); |
| 1939 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => 1, null)); |
| 1940 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => { }, null)); |
| 1941 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => 1, null)); |
| 1942 |
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => 1, null)); |
| 1943 |
#endif |
| 1944 |
} |
| 1945 |
|
| 1946 |
[TestMethod] |
| 1947 |
public void ToAsync0() |
| 1948 |
{ |
| 1949 |
Assert.IsTrue(Observable.ToAsync<int>(() => 0)().ToEnumerable().SequenceEqual(new[] { 0 })); |
| 1950 |
Assert.IsTrue(Observable.ToAsync<int>(() => 0, Scheduler.Default)().ToEnumerable().SequenceEqual(new[] { 0 })); |
| 1951 |
} |
| 1952 |
|
| 1953 |
[TestMethod] |
| 1954 |
public void ToAsync1() |
| 1955 |
{ |
| 1956 |
Assert.IsTrue(Observable.ToAsync<int, int>(a => a)(1).ToEnumerable().SequenceEqual(new[] { 1 })); |
| 1957 |
Assert.IsTrue(Observable.ToAsync<int, int>(a => a, Scheduler.Default)(1).ToEnumerable().SequenceEqual(new[] { 1 })); |
| 1958 |
} |
| 1959 |
|
| 1960 |
[TestMethod] |
| 1961 |
public void ToAsync2() |
| 1962 |
{ |
| 1963 |
Assert.IsTrue(Observable.ToAsync<int, int, int>((a, b) => a + b)(1, 2).ToEnumerable().SequenceEqual(new[] { 1 + 2 })); |
| 1964 |
Assert.IsTrue(Observable.ToAsync<int, int, int>((a, b) => a + b, Scheduler.Default)(1, 2).ToEnumerable().SequenceEqual(new[] { 1 + 2 })); |
| 1965 |
} |
| 1966 |
|
| 1967 |
[TestMethod] |
| 1968 |
public void ToAsync3() |
| 1969 |
{ |
| 1970 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int>((a, b, c) => a + b + c)(1, 2, 3).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 })); |
| 1971 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int>((a, b, c) => a + b + c, Scheduler.Default)(1, 2, 3).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 })); |
| 1972 |
} |
| 1973 |
|
| 1974 |
[TestMethod] |
| 1975 |
public void ToAsync4() |
| 1976 |
{ |
| 1977 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int>((a, b, c, d) => a + b + c + d)(1, 2, 3, 4).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 })); |
| 1978 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int>((a, b, c, d) => a + b + c + d, Scheduler.Default)(1, 2, 3, 4).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 })); |
| 1979 |
} |
| 1980 |
|
| 1981 |
#if !NO_LARGEARITY |
| 1982 |
|
| 1983 |
[TestMethod] |
| 1984 |
public void ToAsync5() |
| 1985 |
{ |
| 1986 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e) => a + b + c + d + e)(1, 2, 3, 4, 5).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 })); |
| 1987 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e) => a + b + c + d + e, Scheduler.Default)(1, 2, 3, 4, 5).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 })); |
| 1988 |
} |
| 1989 |
|
| 1990 |
[TestMethod] |
| 1991 |
public void ToAsync6() |
| 1992 |
{ |
| 1993 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f) => a + b + c + d + e + f)(1, 2, 3, 4, 5, 6).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 })); |
| 1994 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f) => a + b + c + d + e + f, Scheduler.Default)(1, 2, 3, 4, 5, 6).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 })); |
| 1995 |
} |
| 1996 |
|
| 1997 |
[TestMethod] |
| 1998 |
public void ToAsync7() |
| 1999 |
{ |
| 2000 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => a + b + c + d + e + f + g)(1, 2, 3, 4, 5, 6, 7).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 })); |
| 2001 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => a + b + c + d + e + f + g, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 })); |
| 2002 |
} |
| 2003 |
|
| 2004 |
[TestMethod] |
| 2005 |
public void ToAsync8() |
| 2006 |
{ |
| 2007 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => a + b + c + d + e + f + g + h)(1, 2, 3, 4, 5, 6, 7, 8).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 })); |
| 2008 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => a + b + c + d + e + f + g + h, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 })); |
| 2009 |
} |
| 2010 |
|
| 2011 |
[TestMethod] |
| 2012 |
public void ToAsync9() |
| 2013 |
{ |
| 2014 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => a + b + c + d + e + f + g + h + i)(1, 2, 3, 4, 5, 6, 7, 8, 9).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 })); |
| 2015 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => a + b + c + d + e + f + g + h + i, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 })); |
| 2016 |
} |
| 2017 |
|
| 2018 |
[TestMethod] |
| 2019 |
public void ToAsync10() |
| 2020 |
{ |
| 2021 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => a + b + c + d + e + f + g + h + i + j)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 })); |
| 2022 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => a + b + c + d + e + f + g + h + i + j, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 })); |
| 2023 |
} |
| 2024 |
|
| 2025 |
[TestMethod] |
| 2026 |
public void ToAsync11() |
| 2027 |
{ |
| 2028 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => a + b + c + d + e + f + g + h + i + j + k)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 })); |
| 2029 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => a + b + c + d + e + f + g + h + i + j + k, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 })); |
| 2030 |
} |
| 2031 |
|
| 2032 |
[TestMethod] |
| 2033 |
public void ToAsync12() |
| 2034 |
{ |
| 2035 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => a + b + c + d + e + f + g + h + i + j + k + l)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 })); |
| 2036 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => a + b + c + d + e + f + g + h + i + j + k + l, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 })); |
| 2037 |
} |
| 2038 |
|
| 2039 |
[TestMethod] |
| 2040 |
public void ToAsync13() |
| 2041 |
{ |
| 2042 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => a + b + c + d + e + f + g + h + i + j + k + l + m)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 })); |
| 2043 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => a + b + c + d + e + f + g + h + i + j + k + l + m, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 })); |
| 2044 |
} |
| 2045 |
|
| 2046 |
[TestMethod] |
| 2047 |
public void ToAsync14() |
| 2048 |
{ |
| 2049 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => a + b + c + d + e + f + g + h + i + j + k + l + m + n)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 })); |
| 2050 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => a + b + c + d + e + f + g + h + i + j + k + l + m + n, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 })); |
| 2051 |
} |
| 2052 |
|
| 2053 |
[TestMethod] |
| 2054 |
public void ToAsync15() |
| 2055 |
{ |
| 2056 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => a + b + c + d + e + f + g + h + i + j + k + l + m + n + o)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 })); |
| 2057 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => a + b + c + d + e + f + g + h + i + j + k + l + m + n + o, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 })); |
| 2058 |
} |
| 2059 |
|
| 2060 |
[TestMethod] |
| 2061 |
public void ToAsync16() |
| 2062 |
{ |
| 2063 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 })); |
| 2064 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).ToEnumerable().SequenceEqual(new[] { 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 })); |
| 2065 |
} |
| 2066 |
#endif |
| 2067 |
|
| 2068 |
[TestMethod] |
| 2069 |
public void ToAsync_Error0() |
| 2070 |
{ |
| 2071 |
var ex = new Exception(); |
| 2072 |
Assert.IsTrue(Observable.ToAsync<int>(() => { throw ex; })().Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2073 |
} |
| 2074 |
|
| 2075 |
[TestMethod] |
| 2076 |
public void ToAsync_Error1() |
| 2077 |
{ |
| 2078 |
var ex = new Exception(); |
| 2079 |
Assert.IsTrue(Observable.ToAsync<int, int>(a => { throw ex; })(1).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2080 |
} |
| 2081 |
|
| 2082 |
[TestMethod] |
| 2083 |
public void ToAsync_Error2() |
| 2084 |
{ |
| 2085 |
var ex = new Exception(); |
| 2086 |
Assert.IsTrue(Observable.ToAsync<int, int, int>((a, b) => { throw ex; })(1, 2).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2087 |
} |
| 2088 |
|
| 2089 |
[TestMethod] |
| 2090 |
public void ToAsync_Error3() |
| 2091 |
{ |
| 2092 |
var ex = new Exception(); |
| 2093 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int>((a, b, c) => { throw ex; })(1, 2, 3).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2094 |
} |
| 2095 |
|
| 2096 |
[TestMethod] |
| 2097 |
public void ToAsync_Error4() |
| 2098 |
{ |
| 2099 |
var ex = new Exception(); |
| 2100 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int>((a, b, c, d) => { throw ex; })(1, 2, 3, 4).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2101 |
} |
| 2102 |
|
| 2103 |
#if !NO_LARGEARITY |
| 2104 |
|
| 2105 |
[TestMethod] |
| 2106 |
public void ToAsync_Error5() |
| 2107 |
{ |
| 2108 |
var ex = new Exception(); |
| 2109 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e) => { throw ex; })(1, 2, 3, 4, 5).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2110 |
} |
| 2111 |
|
| 2112 |
[TestMethod] |
| 2113 |
public void ToAsync_Error6() |
| 2114 |
{ |
| 2115 |
var ex = new Exception(); |
| 2116 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f) => { throw ex; })(1, 2, 3, 4, 5, 6).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2117 |
} |
| 2118 |
|
| 2119 |
[TestMethod] |
| 2120 |
public void ToAsync_Error7() |
| 2121 |
{ |
| 2122 |
var ex = new Exception(); |
| 2123 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => { throw ex; })(1, 2, 3, 4, 5, 6, 7).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2124 |
} |
| 2125 |
|
| 2126 |
[TestMethod] |
| 2127 |
public void ToAsync_Error8() |
| 2128 |
{ |
| 2129 |
var ex = new Exception(); |
| 2130 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2131 |
} |
| 2132 |
|
| 2133 |
[TestMethod] |
| 2134 |
public void ToAsync_Error9() |
| 2135 |
{ |
| 2136 |
var ex = new Exception(); |
| 2137 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2138 |
} |
| 2139 |
|
| 2140 |
[TestMethod] |
| 2141 |
public void ToAsync_Error10() |
| 2142 |
{ |
| 2143 |
var ex = new Exception(); |
| 2144 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2145 |
} |
| 2146 |
|
| 2147 |
[TestMethod] |
| 2148 |
public void ToAsync_Error11() |
| 2149 |
{ |
| 2150 |
var ex = new Exception(); |
| 2151 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2152 |
} |
| 2153 |
|
| 2154 |
[TestMethod] |
| 2155 |
public void ToAsync_Error12() |
| 2156 |
{ |
| 2157 |
var ex = new Exception(); |
| 2158 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2159 |
} |
| 2160 |
|
| 2161 |
[TestMethod] |
| 2162 |
public void ToAsync_Error13() |
| 2163 |
{ |
| 2164 |
var ex = new Exception(); |
| 2165 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2166 |
} |
| 2167 |
|
| 2168 |
[TestMethod] |
| 2169 |
public void ToAsync_Error14() |
| 2170 |
{ |
| 2171 |
var ex = new Exception(); |
| 2172 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2173 |
} |
| 2174 |
|
| 2175 |
[TestMethod] |
| 2176 |
public void ToAsync_Error15() |
| 2177 |
{ |
| 2178 |
var ex = new Exception(); |
| 2179 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2180 |
} |
| 2181 |
|
| 2182 |
[TestMethod] |
| 2183 |
public void ToAsync_Error16() |
| 2184 |
{ |
| 2185 |
var ex = new Exception(); |
| 2186 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => { throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).Materialize().ToEnumerable().SequenceEqual(new Notification<int>[] { Notification.CreateOnError<int>(ex) })); |
| 2187 |
} |
| 2188 |
#endif |
| 2189 |
|
| 2190 |
[TestMethod] |
| 2191 |
public void ToAsyncAction0() |
| 2192 |
{ |
| 2193 |
bool hasRun = false; |
| 2194 |
Assert.IsTrue(Observable.ToAsync(() => { hasRun = true; })().ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2195 |
Assert.IsTrue(Observable.ToAsync(() => { hasRun = true; }, Scheduler.Default)().ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2196 |
Assert.IsTrue(hasRun, "has run"); |
| 2197 |
} |
| 2198 |
|
| 2199 |
[TestMethod] |
| 2200 |
public void ToAsyncActionError0() |
| 2201 |
{ |
| 2202 |
var ex = new Exception(); |
| 2203 |
Assert.IsTrue(Observable.ToAsync(() => { throw ex; })().Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2204 |
} |
| 2205 |
|
| 2206 |
[TestMethod] |
| 2207 |
public void ToAsyncAction1() |
| 2208 |
{ |
| 2209 |
bool hasRun = false; |
| 2210 |
Assert.IsTrue(Observable.ToAsync<int>(a => { Assert.AreEqual(1, a); hasRun = true; })(1).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2211 |
Assert.IsTrue(Observable.ToAsync<int>(a => { Assert.AreEqual(1, a); hasRun = true; }, Scheduler.Default)(1).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2212 |
Assert.IsTrue(hasRun, "has run"); |
| 2213 |
} |
| 2214 |
|
| 2215 |
[TestMethod] |
| 2216 |
public void ToAsyncActionError1() |
| 2217 |
{ |
| 2218 |
var ex = new Exception(); |
| 2219 |
Assert.IsTrue(Observable.ToAsync<int>(a => { Assert.AreEqual(1, a); throw ex; })(1).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2220 |
} |
| 2221 |
|
| 2222 |
[TestMethod] |
| 2223 |
public void ToAsyncAction2() |
| 2224 |
{ |
| 2225 |
bool hasRun = false; |
| 2226 |
Assert.IsTrue(Observable.ToAsync<int, int>((a, b) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); hasRun = true; })(1, 2).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2227 |
Assert.IsTrue(Observable.ToAsync<int, int>((a, b) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); hasRun = true; }, Scheduler.Default)(1, 2).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2228 |
Assert.IsTrue(hasRun, "has run"); |
| 2229 |
} |
| 2230 |
|
| 2231 |
[TestMethod] |
| 2232 |
public void ToAsyncActionError2() |
| 2233 |
{ |
| 2234 |
var ex = new Exception(); |
| 2235 |
Assert.IsTrue(Observable.ToAsync<int, int>((a, b) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); throw ex; })(1, 2).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2236 |
} |
| 2237 |
|
| 2238 |
[TestMethod] |
| 2239 |
public void ToAsyncAction3() |
| 2240 |
{ |
| 2241 |
bool hasRun = false; |
| 2242 |
Assert.IsTrue(Observable.ToAsync<int, int, int>((a, b, c) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); hasRun = true; })(1, 2, 3).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2243 |
Assert.IsTrue(Observable.ToAsync<int, int, int>((a, b, c) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); hasRun = true; }, Scheduler.Default)(1, 2, 3).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2244 |
Assert.IsTrue(hasRun, "has run"); |
| 2245 |
} |
| 2246 |
|
| 2247 |
[TestMethod] |
| 2248 |
public void ToAsyncActionError3() |
| 2249 |
{ |
| 2250 |
var ex = new Exception(); |
| 2251 |
Assert.IsTrue(Observable.ToAsync<int, int, int>((a, b, c) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); throw ex; })(1, 2, 3).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2252 |
} |
| 2253 |
|
| 2254 |
[TestMethod] |
| 2255 |
public void ToAsyncAction4() |
| 2256 |
{ |
| 2257 |
bool hasRun = false; |
| 2258 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int>((a, b, c, d) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); hasRun = true; })(1, 2, 3, 4).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2259 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int>((a, b, c, d) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2260 |
Assert.IsTrue(hasRun, "has run"); |
| 2261 |
} |
| 2262 |
|
| 2263 |
[TestMethod] |
| 2264 |
public void ToAsyncActionError4() |
| 2265 |
{ |
| 2266 |
var ex = new Exception(); |
| 2267 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int>((a, b, c, d) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); throw ex; })(1, 2, 3, 4).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2268 |
} |
| 2269 |
|
| 2270 |
#if !NO_LARGEARITY |
| 2271 |
|
| 2272 |
[TestMethod] |
| 2273 |
public void ToAsyncAction5() |
| 2274 |
{ |
| 2275 |
bool hasRun = false; |
| 2276 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int>((a, b, c, d, e) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); hasRun = true; })(1, 2, 3, 4, 5).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2277 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int>((a, b, c, d, e) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2278 |
Assert.IsTrue(hasRun, "has run"); |
| 2279 |
} |
| 2280 |
|
| 2281 |
[TestMethod] |
| 2282 |
public void ToAsyncActionError5() |
| 2283 |
{ |
| 2284 |
var ex = new Exception(); |
| 2285 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int>((a, b, c, d, e) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); throw ex; })(1, 2, 3, 4, 5).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2286 |
} |
| 2287 |
|
| 2288 |
[TestMethod] |
| 2289 |
public void ToAsyncAction6() |
| 2290 |
{ |
| 2291 |
bool hasRun = false; |
| 2292 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e, f) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); hasRun = true; })(1, 2, 3, 4, 5, 6).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2293 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e, f) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2294 |
Assert.IsTrue(hasRun, "has run"); |
| 2295 |
} |
| 2296 |
|
| 2297 |
[TestMethod] |
| 2298 |
public void ToAsyncActionError6() |
| 2299 |
{ |
| 2300 |
var ex = new Exception(); |
| 2301 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int>((a, b, c, d, e, f) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); throw ex; })(1, 2, 3, 4, 5, 6).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2302 |
} |
| 2303 |
|
| 2304 |
[TestMethod] |
| 2305 |
public void ToAsyncAction7() |
| 2306 |
{ |
| 2307 |
bool hasRun = false; |
| 2308 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); hasRun = true; })(1, 2, 3, 4, 5, 6, 7).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2309 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2310 |
Assert.IsTrue(hasRun, "has run"); |
| 2311 |
} |
| 2312 |
|
| 2313 |
[TestMethod] |
| 2314 |
public void ToAsyncActionError7() |
| 2315 |
{ |
| 2316 |
var ex = new Exception(); |
| 2317 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int>((a, b, c, d, e, f, g) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); throw ex; })(1, 2, 3, 4, 5, 6, 7).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2318 |
} |
| 2319 |
|
| 2320 |
[TestMethod] |
| 2321 |
public void ToAsyncAction8() |
| 2322 |
{ |
| 2323 |
bool hasRun = false; |
| 2324 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2325 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2326 |
Assert.IsTrue(hasRun, "has run"); |
| 2327 |
} |
| 2328 |
|
| 2329 |
[TestMethod] |
| 2330 |
public void ToAsyncActionError8() |
| 2331 |
{ |
| 2332 |
var ex = new Exception(); |
| 2333 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2334 |
} |
| 2335 |
|
| 2336 |
[TestMethod] |
| 2337 |
public void ToAsyncAction9() |
| 2338 |
{ |
| 2339 |
bool hasRun = false; |
| 2340 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2341 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2342 |
Assert.IsTrue(hasRun, "has run"); |
| 2343 |
} |
| 2344 |
|
| 2345 |
[TestMethod] |
| 2346 |
public void ToAsyncActionError9() |
| 2347 |
{ |
| 2348 |
var ex = new Exception(); |
| 2349 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2350 |
} |
| 2351 |
|
| 2352 |
[TestMethod] |
| 2353 |
public void ToAsyncAction10() |
| 2354 |
{ |
| 2355 |
bool hasRun = false; |
| 2356 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2357 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2358 |
Assert.IsTrue(hasRun, "has run"); |
| 2359 |
} |
| 2360 |
|
| 2361 |
[TestMethod] |
| 2362 |
public void ToAsyncActionError10() |
| 2363 |
{ |
| 2364 |
var ex = new Exception(); |
| 2365 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2366 |
} |
| 2367 |
|
| 2368 |
[TestMethod] |
| 2369 |
public void ToAsyncAction11() |
| 2370 |
{ |
| 2371 |
bool hasRun = false; |
| 2372 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2373 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2374 |
Assert.IsTrue(hasRun, "has run"); |
| 2375 |
} |
| 2376 |
|
| 2377 |
[TestMethod] |
| 2378 |
public void ToAsyncActionError11() |
| 2379 |
{ |
| 2380 |
var ex = new Exception(); |
| 2381 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2382 |
} |
| 2383 |
|
| 2384 |
[TestMethod] |
| 2385 |
public void ToAsyncAction12() |
| 2386 |
{ |
| 2387 |
bool hasRun = false; |
| 2388 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2389 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2390 |
Assert.IsTrue(hasRun, "has run"); |
| 2391 |
} |
| 2392 |
|
| 2393 |
[TestMethod] |
| 2394 |
public void ToAsyncActionError12() |
| 2395 |
{ |
| 2396 |
var ex = new Exception(); |
| 2397 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2398 |
} |
| 2399 |
|
| 2400 |
[TestMethod] |
| 2401 |
public void ToAsyncAction13() |
| 2402 |
{ |
| 2403 |
bool hasRun = false; |
| 2404 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2405 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2406 |
Assert.IsTrue(hasRun, "has run"); |
| 2407 |
} |
| 2408 |
|
| 2409 |
[TestMethod] |
| 2410 |
public void ToAsyncActionError13() |
| 2411 |
{ |
| 2412 |
var ex = new Exception(); |
| 2413 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2414 |
} |
| 2415 |
|
| 2416 |
[TestMethod] |
| 2417 |
public void ToAsyncAction14() |
| 2418 |
{ |
| 2419 |
bool hasRun = false; |
| 2420 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2421 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2422 |
Assert.IsTrue(hasRun, "has run"); |
| 2423 |
} |
| 2424 |
|
| 2425 |
[TestMethod] |
| 2426 |
public void ToAsyncActionError14() |
| 2427 |
{ |
| 2428 |
var ex = new Exception(); |
| 2429 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2430 |
} |
| 2431 |
|
| 2432 |
[TestMethod] |
| 2433 |
public void ToAsyncAction15() |
| 2434 |
{ |
| 2435 |
bool hasRun = false; |
| 2436 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); Assert.AreEqual(15, o); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2437 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); Assert.AreEqual(15, o); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2438 |
Assert.IsTrue(hasRun, "has run"); |
| 2439 |
} |
| 2440 |
|
| 2441 |
[TestMethod] |
| 2442 |
public void ToAsyncActionError15() |
| 2443 |
{ |
| 2444 |
var ex = new Exception(); |
| 2445 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); Assert.AreEqual(15, o); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2446 |
} |
| 2447 |
|
| 2448 |
[TestMethod] |
| 2449 |
public void ToAsyncAction16() |
| 2450 |
{ |
| 2451 |
bool hasRun = false; |
| 2452 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); Assert.AreEqual(15, o); Assert.AreEqual(16, p); hasRun = true; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2453 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); Assert.AreEqual(15, o); Assert.AreEqual(16, p); hasRun = true; }, Scheduler.Default)(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).ToEnumerable().SequenceEqual(new[] { new Unit() })); |
| 2454 |
Assert.IsTrue(hasRun, "has run"); |
| 2455 |
} |
| 2456 |
|
| 2457 |
[TestMethod] |
| 2458 |
public void ToAsyncActionError16() |
| 2459 |
{ |
| 2460 |
var ex = new Exception(); |
| 2461 |
Assert.IsTrue(Observable.ToAsync<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => { Assert.AreEqual(1, a); Assert.AreEqual(2, b); Assert.AreEqual(3, c); Assert.AreEqual(4, d); Assert.AreEqual(5, e); Assert.AreEqual(6, f); Assert.AreEqual(7, g); Assert.AreEqual(8, h); Assert.AreEqual(9, i); Assert.AreEqual(10, j); Assert.AreEqual(11, k); Assert.AreEqual(12, l); Assert.AreEqual(13, m); Assert.AreEqual(14, n); Assert.AreEqual(15, o); Assert.AreEqual(16, p); throw ex; })(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).Materialize().ToEnumerable().SequenceEqual(new[] { Notification.CreateOnError<Unit>(ex) })); |
| 2462 |
} |
| 2463 |
#endif |
| 2464 |
|
| 2465 |
#endregion |
| 2466 |
} |
| 2467 |
} |