diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPool.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPool.cs index 930b64c8..7793e275 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPool.cs +++ b/Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPool.cs @@ -1,4 +1,5 @@ -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member +#if CSHARP_7_OR_LATER +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member using System; using System.Threading; @@ -147,4 +148,5 @@ static int GetQueueIndex(int size) } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Async/Internal/PlayerLoopRunner.cs b/Assets/Plugins/UniRx/Scripts/Async/Internal/PlayerLoopRunner.cs index bf6fe5fc..fc7d10d4 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/Internal/PlayerLoopRunner.cs +++ b/Assets/Plugins/UniRx/Scripts/Async/Internal/PlayerLoopRunner.cs @@ -1,4 +1,4 @@ -#if UNITY_2018_1_OR_NEWER +#if CSHARP_7_OR_LATER using System; using UnityEngine; diff --git a/Assets/Plugins/UniRx/Scripts/Async/PlayerLoopHelper.cs b/Assets/Plugins/UniRx/Scripts/Async/PlayerLoopHelper.cs index 7f5ef96e..d389e7eb 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/PlayerLoopHelper.cs +++ b/Assets/Plugins/UniRx/Scripts/Async/PlayerLoopHelper.cs @@ -1,4 +1,4 @@ -#if UNITY_2018_1_OR_NEWER +#if CSHARP_7_OR_LATER #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member using System; diff --git a/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.cs b/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.cs index 6e0250ac..539641b6 100644 --- a/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.cs +++ b/Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.cs @@ -1,4 +1,4 @@ -#if (NET_4_6 || NET_STANDARD_2_0) && CSHARP_7_OR_LATER +#if CSHARP_7_OR_LATER #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member using System; diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs index aeb5f4e2..8a02cb15 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs @@ -104,6 +104,8 @@ public static IObservable OnValueChangedAsObservable(this InputField inp } #endif +#if UNITY_5_3_OR_NEWER + /// Observe onValueChanged with current `value` on subscribe. public static IObservable OnValueChangedAsObservable(this Dropdown dropdown) { @@ -113,6 +115,8 @@ public static IObservable OnValueChangedAsObservable(this Dropdown dropdown return d.onValueChanged.AsObservable().Subscribe(observer); }); } + +#endif } } diff --git a/Assets/Scripts/UnityTests/AsyncTestSample.cs b/Assets/Scripts/UnityTests/AsyncTestSample.cs index eadfef3e..e98694fe 100644 --- a/Assets/Scripts/UnityTests/AsyncTestSample.cs +++ b/Assets/Scripts/UnityTests/AsyncTestSample.cs @@ -1,4 +1,5 @@ -#pragma warning disable CS1591 +#if CSHARP_7_OR_LATER +#pragma warning disable CS1591 using UnityEngine.TestTools; using System.Collections; @@ -11,6 +12,8 @@ public class AsyncTestSample { +#if ENABLE_WWW + [UnityTest] public IEnumerator AsyncTest() => UniTask.ToCoroutine(async () => { @@ -30,4 +33,8 @@ public IEnumerator AsyncTest() => UniTask.ToCoroutine(async () => var req = await UnityWebRequest.Get("http://google.co.jp/").SendWebRequest(); req.downloadHandler.text.Contains("Google").IsTrue(); }); + +#endif } + +#endif \ No newline at end of file diff --git a/Assets/Scripts/UnityTests/ChainingAssertion.Unity.cs b/Assets/Scripts/UnityTests/ChainingAssertion.Unity.cs index 9100f32c..b7701647 100644 --- a/Assets/Scripts/UnityTests/ChainingAssertion.Unity.cs +++ b/Assets/Scripts/UnityTests/ChainingAssertion.Unity.cs @@ -1,9 +1,6 @@ -#pragma warning disable CS1591 - -using System; +using System; using System.Collections; using System.Collections.Generic; -using System.Diagnostics.Contracts; using System.Linq; using System.Reflection; @@ -12,7 +9,6 @@ // no namespace. [System.Diagnostics.DebuggerStepThroughAttribute] -[ContractVerification(false)] public static partial class ChainingAssertion { /// Assert.AreEqual, if T is IEnumerable then CollectionAssert.AreEqual @@ -219,7 +215,7 @@ public static void IsStructuralEqual(this object actual, object expected, string if (!r.IsEquals) { var msg = string.Format("is not structural equal, failed at {0}, actual = {1} expected = {2}", - string.Join(".", r.Names), r.Left, r.Right); + string.Join(".", r.Names.ToArray()), r.Left, r.Right); throw new AssertionException(msg, message); } } @@ -318,9 +314,9 @@ static EqualInfo StructuralEqual(object left, object right, IEnumerable // is object var fields = left.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public); var properties = left.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public).Where(x => x.GetGetMethod(false) != null); - var members = fields.Cast().Concat(properties); + var members = fields.Cast().Concat(properties.Cast()); - foreach (var mi in fields.Cast().Concat(properties)) + foreach (var mi in members) { var concatNames = names.Concat(new[] { (string)mi.Name }); @@ -336,8 +332,8 @@ static EqualInfo StructuralEqual(object left, object right, IEnumerable else { var i = mi as PropertyInfo; - lv = i.GetValue(left); - rv = i.GetValue(right); + lv = i.GetValue(left, null); + rv = i.GetValue(right, null); } var result = StructuralEqual(lv, rv, concatNames); diff --git a/Assets/Scripts/UnityTests/Rx/ArrayPoolTest.cs b/Assets/Scripts/UnityTests/Rx/ArrayPoolTest.cs index ca27fdaa..e85dd0fe 100644 --- a/Assets/Scripts/UnityTests/Rx/ArrayPoolTest.cs +++ b/Assets/Scripts/UnityTests/Rx/ArrayPoolTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +#if CSHARP_7_OR_LATER +using NUnit.Framework; using System; using UniRx.Async.Internal; using System.Collections.Generic; @@ -33,3 +34,5 @@ public void Rent() } } } + +#endif \ No newline at end of file diff --git a/Assets/Scripts/UnityTests/Rx/MicroCoroutineTest.cs b/Assets/Scripts/UnityTests/Rx/MicroCoroutineTest.cs index b32efa92..a7888833 100644 --- a/Assets/Scripts/UnityTests/Rx/MicroCoroutineTest.cs +++ b/Assets/Scripts/UnityTests/Rx/MicroCoroutineTest.cs @@ -25,9 +25,9 @@ public object Current return null; } } - public int OriginalCount => original; + public int OriginalCount { get { return original; } } - public int Count => count; + public int Count { get { return count; } } public bool MoveNext() { @@ -41,7 +41,7 @@ public void Reset() public override string ToString() { - return $"{count}/{original}"; + return count + "/" + "original"; } } diff --git a/Assets/Scripts/UnityTests/Rx/ReactivePropertyTest.cs b/Assets/Scripts/UnityTests/Rx/ReactivePropertyTest.cs index cc05f367..d4e9fea0 100644 --- a/Assets/Scripts/UnityTests/Rx/ReactivePropertyTest.cs +++ b/Assets/Scripts/UnityTests/Rx/ReactivePropertyTest.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; using NUnit.Framework; namespace UniRx.Tests @@ -357,7 +356,7 @@ public void FinishedSourceToReadOnlyReactiveProperty() // immediate { - var ex = new Exception(); + // var ex = new Exception(); var source = new Subject(); var rxProp = source.ToReadOnlyReactiveProperty(); diff --git a/Assets/Scripts/UnityTests/Rx/SelectWhereOptimizeTest.cs b/Assets/Scripts/UnityTests/Rx/SelectWhereOptimizeTest.cs index 7b42dbc5..610ab4f8 100644 --- a/Assets/Scripts/UnityTests/Rx/SelectWhereOptimizeTest.cs +++ b/Assets/Scripts/UnityTests/Rx/SelectWhereOptimizeTest.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; namespace UniRx.Tests { @@ -14,9 +13,9 @@ public class SelectWhereOptimizeTest public void SelectSelect() { // Combine selector currently disabled. - var selectselect = Observable.Range(1, 10) - .Select(x => x) - .Select(x => x * -1); + //var selectselect = Observable.Range(1, 10) + // .Select(x => x) + // .Select(x => x * -1); } [Test]