From f4c8bd982182d2d9d753a9e7351a052201746e8a Mon Sep 17 00:00:00 2001 From: MichaCo Date: Sat, 26 Dec 2015 01:39:38 +0100 Subject: [PATCH] fixing mono build. Mocking HttpContext.Current doesn't work on Mono for some reason (see https://bugzilla.xamarin.com/show_bug.cgi?id=24308) --- test/CacheManager.Tests.Net40/CacheManager.Tests.Net40.csproj | 2 +- test/CacheManager.Tests.Net45/CacheManager.Tests.Net45.csproj | 2 +- test/CacheManager.Tests/BaseCacheManagerTest.cs | 4 ++-- test/CacheManager.Tests/SystemWebCacheHandleWrapper.cs | 4 +++- test/CacheManager.Tests/project.json | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/test/CacheManager.Tests.Net40/CacheManager.Tests.Net40.csproj b/test/CacheManager.Tests.Net40/CacheManager.Tests.Net40.csproj index 81c6a440..3f3218a7 100644 --- a/test/CacheManager.Tests.Net40/CacheManager.Tests.Net40.csproj +++ b/test/CacheManager.Tests.Net40/CacheManager.Tests.Net40.csproj @@ -21,7 +21,7 @@ full false bin\Debug\ - TRACE;DEBUG;NET40;REDISENABLED + TRACE;DEBUG;NET40;REDISENABLED;MOCK_HTTPCONTEXTE_ENABLED prompt 4 false diff --git a/test/CacheManager.Tests.Net45/CacheManager.Tests.Net45.csproj b/test/CacheManager.Tests.Net45/CacheManager.Tests.Net45.csproj index 056f2206..215362aa 100644 --- a/test/CacheManager.Tests.Net45/CacheManager.Tests.Net45.csproj +++ b/test/CacheManager.Tests.Net45/CacheManager.Tests.Net45.csproj @@ -21,7 +21,7 @@ full false bin\Debug\ - TRACE;DEBUG;CODE_ANALYSIS;NET45;REDISENABLED + TRACE;DEBUG;CODE_ANALYSIS;CODE_ANALYSIS;NET45;REDISENABLED;MOCK_HTTPCONTEXTE_ENABLED prompt 4 ..\..\common\CacheManager.Test.ruleset diff --git a/test/CacheManager.Tests/BaseCacheManagerTest.cs b/test/CacheManager.Tests/BaseCacheManagerTest.cs index 2041f3c0..89a29eb1 100644 --- a/test/CacheManager.Tests/BaseCacheManagerTest.cs +++ b/test/CacheManager.Tests/BaseCacheManagerTest.cs @@ -100,7 +100,7 @@ public static ICacheManager WithTwoNamedMemoryCaches .EnableStatistics(); }); -#if !NET40 +#if !NET40 && MOCK_HTTPCONTEXTE_ENABLED public static ICacheManager WithSystemWebCache => CacheFactory.Build( settings => @@ -291,7 +291,7 @@ public static IEnumerable TestCacheManagers #endif //// yield return new object[] { TestManagers.WithMemcached }; //// yield return new object[] { TestManagers.WithCouchbaseMemcached }; -#if !NET40 +#if !NET40 && MOCK_HTTPCONTEXTE_ENABLED yield return new object[] { TestManagers.WithSystemWebCache }; #endif } diff --git a/test/CacheManager.Tests/SystemWebCacheHandleWrapper.cs b/test/CacheManager.Tests/SystemWebCacheHandleWrapper.cs index 97f33926..4f703b1e 100644 --- a/test/CacheManager.Tests/SystemWebCacheHandleWrapper.cs +++ b/test/CacheManager.Tests/SystemWebCacheHandleWrapper.cs @@ -1,4 +1,6 @@ -#if !NET40 +// disabling for NET40, our Web implementation is not available on that framework +// disabling it for builds on Mono because setting the HttpContext.Current causes all kinds of strange exceptions +#if !NET40 && MOCK_HTTPCONTEXTE_ENABLED using System.IO; using System.Web; using CacheManager.Core; diff --git a/test/CacheManager.Tests/project.json b/test/CacheManager.Tests/project.json index 6b294da4..8e77d47f 100644 --- a/test/CacheManager.Tests/project.json +++ b/test/CacheManager.Tests/project.json @@ -17,7 +17,7 @@ }, "compilationOptions": { "define": [ - "REDISENABLED" + "REDISENABLED", "MOCK_HTTPCONTEXTE_ENABLED" ] } }