blob: fa7ed146f33653a614f66547b4b61b0a9b56679f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace ReactiveTests
{
#if SILVERLIGHT && !SILVERLIGHTM7
public class TestBase : Microsoft.Silverlight.Testing.SilverlightTest
{
public void RunAsync(Action<Waiter> a)
{
EnqueueCallback(() =>
{
var w = new Waiter(TestComplete);
a(w);
w.Wait();
});
}
public void CompleteAsync()
{
EnqueueTestComplete();
}
}
public class Waiter
{
private Action _complete;
public Waiter(Action complete)
{
_complete = complete;
}
public void Set()
{
_complete();
}
public void Wait()
{
}
}
#else
public class TestBase
{
public void RunAsync(Action<Waiter> a)
{
var w = new Waiter();
a(w);
w.Wait();
}
}
public class Waiter
{
private ManualResetEvent _evt = new ManualResetEvent(false);
public void Set()
{
_evt.Set();
}
public void Wait()
{
_evt.WaitOne();
}
}
[AttributeUsage(AttributeTargets.Method)]
public class AsynchronousAttribute : Attribute
{
}
#endif
}
|