diff options
author | Atsushi Eno <atsushieno@veritas-vos-liberabit.com> | 2013-01-22 19:10:51 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@veritas-vos-liberabit.com> | 2013-01-22 19:10:51 +0400 |
commit | 893ba74106ab881ff03050517d3af2369fb197ab (patch) | |
tree | 554b83f4a46527950226554b977e824bbfca9f6d /Rx/NET/Source | |
parent | 0d4c232972c231d06bc69415f99e332a59767ab4 (diff) |
re-apply condition for windows threading, reflection emit and CurrentDomain.
Diffstat (limited to 'Rx/NET/Source')
10 files changed, 56 insertions, 11 deletions
diff --git a/Rx/NET/Source/Tests.System.Reactive/DispatcherHelpers.cs b/Rx/NET/Source/Tests.System.Reactive/DispatcherHelpers.cs index 2eefed5..79c236f 100644 --- a/Rx/NET/Source/Tests.System.Reactive/DispatcherHelpers.cs +++ b/Rx/NET/Source/Tests.System.Reactive/DispatcherHelpers.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if !NO_WINDOWS_THREADING using System; using System.Threading; using System.Windows.Threading; @@ -66,3 +67,5 @@ namespace ReactiveTests } } } + +#endif diff --git a/Rx/NET/Source/Tests.System.Reactive/Tests/Concurrency/DispatcherSchedulerTest.cs b/Rx/NET/Source/Tests.System.Reactive/Tests/Concurrency/DispatcherSchedulerTest.cs index 1f6854e..11e5fd3 100644 --- a/Rx/NET/Source/Tests.System.Reactive/Tests/Concurrency/DispatcherSchedulerTest.cs +++ b/Rx/NET/Source/Tests.System.Reactive/Tests/Concurrency/DispatcherSchedulerTest.cs @@ -1,4 +1,5 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if !NO_WINDOWS_THREADING using System; using System.Diagnostics; @@ -265,3 +266,5 @@ namespace ReactiveTests.Tests #endif } } + +#endif diff --git a/Rx/NET/Source/Tests.System.Reactive/Tests/Concurrency/SchedulerTest.cs b/Rx/NET/Source/Tests.System.Reactive/Tests/Concurrency/SchedulerTest.cs index 0b72487..cc7e87b 100644 --- a/Rx/NET/Source/Tests.System.Reactive/Tests/Concurrency/SchedulerTest.cs +++ b/Rx/NET/Source/Tests.System.Reactive/Tests/Concurrency/SchedulerTest.cs @@ -57,9 +57,11 @@ namespace ReactiveTests.Tests ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.CurrentThread.Schedule(default(Action))); ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.CurrentThread.Schedule(TimeSpan.Zero, default(Action))); ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.CurrentThread.Schedule(DateTimeOffset.MaxValue, default(Action))); +#if !NO_WINDOWS_THREADING ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherScheduler.Instance.Schedule(default(Action))); ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherScheduler.Instance.Schedule(TimeSpan.Zero, default(Action))); ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherScheduler.Instance.Schedule(DateTimeOffset.MaxValue, default(Action))); +#endif ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Immediate.Schedule(default(Action))); ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Immediate.Schedule(TimeSpan.Zero, default(Action))); ReactiveAssert.Throws<ArgumentNullException>(() => Scheduler.Immediate.Schedule(DateTimeOffset.MaxValue, default(Action))); @@ -333,7 +335,7 @@ namespace ReactiveTests.Tests [TestMethod] public void Scheduler_Periodic_HostLifecycleManagement() { - var cur = AppDomain.CurrentDomain.BaseDirectory; + var cur = Utils.GetTestBaseDirectory(); var domain = AppDomain.CreateDomain("HLN", null, new AppDomainSetup { ApplicationBase = cur }); diff --git a/Rx/NET/Source/Tests.System.Reactive/Tests/DefaultConcurrencyAbstractionLayerTest.cs b/Rx/NET/Source/Tests.System.Reactive/Tests/DefaultConcurrencyAbstractionLayerTest.cs index bc49c54..e226ca2 100644 --- a/Rx/NET/Source/Tests.System.Reactive/Tests/DefaultConcurrencyAbstractionLayerTest.cs +++ b/Rx/NET/Source/Tests.System.Reactive/Tests/DefaultConcurrencyAbstractionLayerTest.cs @@ -29,7 +29,7 @@ namespace ReactiveTests.Tests { if (_domain == null) { - var cur = AppDomain.CurrentDomain.BaseDirectory; + var cur = Utils.GetTestBaseDirectory(); var sub = Path.Combine(cur, "NoCAL"); if (!Directory.Exists(sub)) diff --git a/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/ObservableConcurrencyTest.cs b/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/ObservableConcurrencyTest.cs index 234661a..3f39d8d 100644 --- a/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/ObservableConcurrencyTest.cs +++ b/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/ObservableConcurrencyTest.cs @@ -9,7 +9,9 @@ using System.Reactive.Disposables; using System.Reactive.Linq; using System.Reactive.Subjects; using System.Threading; +#if !NO_WINDOWS_THREADING using System.Windows.Threading; +#endif using Microsoft.Reactive.Testing; #if NUNIT using NUnit.Framework; @@ -49,6 +51,7 @@ namespace ReactiveTests.Tests ReactiveAssert.Throws<ArgumentNullException>(() => ControlObservable.ObserveOn<int>(someObservable, default(Label))); #endif +#if !NO_WINDOWS_THREADING #if USE_SL_DISPATCHER ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(default(IObservable<int>), new DispatcherScheduler(System.Windows.Deployment.Current.Dispatcher))); #else @@ -62,11 +65,11 @@ namespace ReactiveTests.Tests ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.ObserveOn<int>(default(IObservable<int>), Dispatcher.CurrentDispatcher)); #endif ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.ObserveOn<int>(someObservable, default(Dispatcher))); - ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(default(IObservable<int>), new SynchronizationContext())); ReactiveAssert.Throws<ArgumentNullException>(() => Observable.ObserveOn<int>(someObservable, default(SynchronizationContext))); ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.ObserveOnDispatcher<int>(default(IObservable<int>))); +#endif } #if HAS_WINFORMS @@ -129,6 +132,7 @@ namespace ReactiveTests.Tests } #endif +#if !NO_WINDOWS_THREADING [TestMethod] [Asynchronous] public void ObserveOn_Dispatcher() @@ -228,6 +232,7 @@ namespace ReactiveTests.Tests })); }); } +#endif #endregion @@ -246,6 +251,7 @@ namespace ReactiveTests.Tests ReactiveAssert.Throws<ArgumentNullException>(() => ControlObservable.SubscribeOn<int>(someObservable, default(Label))); #endif +#if !NO_WINDOWS_THREADING #if USE_SL_DISPATCHER ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(default(IObservable<int>), new DispatcherScheduler(System.Windows.Deployment.Current.Dispatcher))); #else @@ -264,6 +270,7 @@ namespace ReactiveTests.Tests ReactiveAssert.Throws<ArgumentNullException>(() => Observable.SubscribeOn<int>(someObservable, default(SynchronizationContext))); ReactiveAssert.Throws<ArgumentNullException>(() => DispatcherObservable.SubscribeOnDispatcher<int>(default(IObservable<int>))); +#endif } #if HAS_WINFORMS @@ -332,6 +339,7 @@ namespace ReactiveTests.Tests } #endif +#if !NO_WINDOWS_THREADING [TestMethod] [Asynchronous] public void SubscribeOn_Dispatcher() @@ -428,6 +436,7 @@ namespace ReactiveTests.Tests })); }); } +#endif #endregion diff --git a/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/ObservableRemotingTest.cs b/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/ObservableRemotingTest.cs index 2848810..444ca82 100644 --- a/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/ObservableRemotingTest.cs +++ b/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/ObservableRemotingTest.cs @@ -34,8 +34,10 @@ namespace ReactiveTests.Tests RemotingObservable.Remotable(Observable.Return(42)); RemotingObservable.Remotable(Observable.Return(42), null /* valid lease object */); +#if !NO_REFLECTION_EMIT RemotingObservable.Remotable(Qbservable.Return(Qbservable.Provider, 42)); RemotingObservable.Remotable(Qbservable.Return(Qbservable.Provider, 42), null /* valid lease object */); +#endif } class MyLease : ILease @@ -179,7 +181,7 @@ namespace ReactiveTests.Tests private RemotingTest GetRemoteTestObject() { - var ads = new AppDomainSetup { ApplicationBase = AppDomain.CurrentDomain.BaseDirectory }; + var ads = new AppDomainSetup { ApplicationBase = Utils.GetTestBaseDirectory() }; var ad = AppDomain.CreateDomain("test", null, ads); var test = (RemotingTest)ad.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, "ReactiveTests.Tests.RemotingTest"); return test; diff --git a/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/QbservableExTest.cs b/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/QbservableExTest.cs index 951f94b..cbd21a0 100644 --- a/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/QbservableExTest.cs +++ b/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/QbservableExTest.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if !NO_REFLECTION_EMIT #if !SILVERLIGHTM7 using System; @@ -77,4 +78,5 @@ namespace ReactiveTests.Tests } } +#endif #endif
\ No newline at end of file diff --git a/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/QbservableTest.cs b/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/QbservableTest.cs index 39ddae6..cc3c5b2 100644 --- a/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/QbservableTest.cs +++ b/Rx/NET/Source/Tests.System.Reactive/Tests/Linq/QbservableTest.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. +#if !NO_REFLECTION_EMIT #if !SILVERLIGHTM7 using System; @@ -870,14 +871,18 @@ namespace ReactiveTests.Tests { ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbMy, default(IScheduler))); ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbMy, default(SynchronizationContext))); +#if !NO_WINDOWS_THREADING ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbMy, default(DispatcherScheduler))); +#endif #if HAS_WINFORMS ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbMy, default(ControlScheduler))); ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, new ControlScheduler(new System.Windows.Forms.Form()))); #endif ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, Scheduler.Immediate)); ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, new SynchronizationContext())); - ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, DispatcherScheduler.Instance)); +#if !NO_WINDOWS_THREADING + ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.ObserveOn(_qbNull, DispatcherScheduler.Instance)); +#endif } [TestMethod] @@ -885,7 +890,9 @@ namespace ReactiveTests.Tests { _qbMy.ObserveOn(Scheduler.Immediate); _qbMy.ObserveOn(new SynchronizationContext()); - Qbservable.ObserveOn(_qbMy, DispatcherScheduler.Instance); +#if !NO_WINDOWS_THREADING + Qbservable.ObserveOn(_qbMy, DispatcherScheduler.Instance); +#endif } [TestMethod] @@ -1151,10 +1158,14 @@ namespace ReactiveTests.Tests { ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbMy, default(IScheduler))); ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbMy, default(SynchronizationContext))); - ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbMy, default(DispatcherScheduler))); +#if !NO_WINDOWS_THREADING + ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbMy, default(DispatcherScheduler))); +#endif ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbNull, Scheduler.Immediate)); ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbNull, new SynchronizationContext())); - ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbNull, DispatcherScheduler.Instance)); +#if !NO_WINDOWS_THREADING + ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbNull, DispatcherScheduler.Instance)); +#endif #if HAS_WINFORMS ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbMy, default(ControlScheduler))); ReactiveAssert.Throws<ArgumentNullException>(() => Qbservable.SubscribeOn(_qbNull, new ControlScheduler(new System.Windows.Forms.Form()))); @@ -1166,7 +1177,9 @@ namespace ReactiveTests.Tests { _qbMy.SubscribeOn(Scheduler.Immediate); _qbMy.SubscribeOn(new SynchronizationContext()); - Qbservable.SubscribeOn(_qbMy, DispatcherScheduler.Instance); +#if !NO_WINDOWS_THREADING + Qbservable.SubscribeOn(_qbMy, DispatcherScheduler.Instance); +#endif #if HAS_WINFORMS _qbMy.SubscribeOn(new ControlScheduler(new System.Windows.Forms.Form())); #endif @@ -2118,4 +2131,5 @@ namespace ReactiveTests.Tests } } -#endif
\ No newline at end of file +#endif +#endif diff --git a/Rx/NET/Source/Tests.System.Reactive/Tests/SystemClockTest.cs b/Rx/NET/Source/Tests.System.Reactive/Tests/SystemClockTest.cs index 02c5492..7324b0f 100644 --- a/Rx/NET/Source/Tests.System.Reactive/Tests/SystemClockTest.cs +++ b/Rx/NET/Source/Tests.System.Reactive/Tests/SystemClockTest.cs @@ -33,7 +33,7 @@ namespace ReactiveTests.Tests { private void Run(CrossAppDomainDelegate a) { - var domain = AppDomain.CreateDomain(Guid.NewGuid().ToString(), null, new AppDomainSetup { ApplicationBase = AppDomain.CurrentDomain.BaseDirectory }); + var domain = AppDomain.CreateDomain(Guid.NewGuid().ToString(), null, new AppDomainSetup { ApplicationBase = Utils.GetTestBaseDirectory() }); domain.DoCallBack(a); AppDomain.Unload(domain); } diff --git a/Rx/NET/Source/Tests.System.Reactive/Utils.cs b/Rx/NET/Source/Tests.System.Reactive/Utils.cs index 6c8fe3f..c7b099b 100644 --- a/Rx/NET/Source/Tests.System.Reactive/Utils.cs +++ b/Rx/NET/Source/Tests.System.Reactive/Utils.cs @@ -18,5 +18,15 @@ namespace ReactiveTests return a != null && a.FrameworkDisplayName == ".NET Portable Subset"; #endif } + + public static string GetTestBaseDirectory() + { +#if MONODROID || MONOTOUCH + // There is no accessible file system inside android application. + return System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData); +#else + return System.AppDomain.CurrentDomain.BaseDirectory; +#endif + } } } |