You've already forked linux-packaging-mono
Imported Upstream version 5.10.0.47
Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
parent
88ff76fe28
commit
e46a49ecf1
@@ -1,5 +1,4 @@
|
||||
Common/AppDomainTools.cs
|
||||
Common/AssertExtensions.cs
|
||||
Common/PokerChangeMonitor.cs
|
||||
Common/PokerMemoryCache.cs
|
||||
Common/PokerObjectCache.cs
|
||||
|
@@ -1,82 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.Common
|
||||
{
|
||||
delegate void AssertThrowsDelegate();
|
||||
|
||||
static class AssertExtensions
|
||||
{
|
||||
public static void AreEqual (byte[] expected, byte[] data, string message)
|
||||
{
|
||||
if (expected == null) {
|
||||
if (data == null)
|
||||
return;
|
||||
Assert.Fail ("{0}{1}Expected: null{1}Got: byte array with {2} elements and of rank {3}{1}",
|
||||
message, Environment.NewLine, data.Length, data.Rank);
|
||||
}
|
||||
|
||||
if (data == null)
|
||||
Assert.Fail ("{0}{1}Expected: byte array with {2} elements and rank {3}{1}Got: null{1}",
|
||||
message, Environment.NewLine, expected.Length, expected.Rank);
|
||||
|
||||
if (expected.Rank > 1)
|
||||
Assert.Fail ("Only single-dimensional arrays are supported.");
|
||||
|
||||
if (expected.Rank != data.Rank || expected.Length != data.Length)
|
||||
Assert.Fail ("{0}{1}Expected: byte array with {2} elements and rank {3}{1}Got: byte array with {4} elements and rank {5}{1}",
|
||||
message, Environment.NewLine, expected.Length, expected.Rank, data.Length, data.Rank);
|
||||
|
||||
int max = expected.Length;
|
||||
for (int i = 0; i < max; i++) {
|
||||
if (expected[i] != data[i])
|
||||
Assert.Fail ("{0}{1}Arrays differ at index {2}.{1}Expected 0x{3:X} got 0x{4:X}{1}",
|
||||
message, Environment.NewLine, i, expected[i], data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Throws<ET> (AssertThrowsDelegate code, string message)
|
||||
{
|
||||
Throws(typeof(ET), code, message);
|
||||
}
|
||||
|
||||
public static void Throws(Type exceptionType, AssertThrowsDelegate code, string message)
|
||||
{
|
||||
if (code == null)
|
||||
Assert.Fail("No code provided for the test.");
|
||||
|
||||
Exception exception = null;
|
||||
try
|
||||
{
|
||||
code();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
}
|
||||
|
||||
if (exceptionType == null)
|
||||
{
|
||||
if (exception == null)
|
||||
Assert.Fail("{0}{1}Expected: any exception thrown{1}But was: no exception thrown{1}",
|
||||
message, Environment.NewLine);
|
||||
return;
|
||||
}
|
||||
|
||||
if (exception == null || exception.GetType() != exceptionType)
|
||||
Assert.Fail("{0}{1}Expected: {2}{1}But was: {3}{1}{4}{1}",
|
||||
message,
|
||||
Environment.NewLine,
|
||||
exceptionType,
|
||||
exception == null ? "no exception" : exception.GetType().ToString(),
|
||||
exception == null ? "no exception" : exception.ToString());
|
||||
}
|
||||
|
||||
public static void Throws(AssertThrowsDelegate code, string message)
|
||||
{
|
||||
Throws(null, code, message);
|
||||
}
|
||||
}
|
||||
}
|
@@ -50,28 +50,28 @@ namespace MonoTests.System.Runtime.Caching
|
||||
relPath
|
||||
};
|
||||
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
monitor = new HostFileChangeMonitor (paths);
|
||||
}, "#A1");
|
||||
|
||||
paths.Clear ();
|
||||
paths.Add (null);
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
monitor = new HostFileChangeMonitor (paths);
|
||||
}, "#A2");
|
||||
|
||||
paths.Clear ();
|
||||
paths.Add (String.Empty);
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
monitor = new HostFileChangeMonitor (paths);
|
||||
}, "#A3");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
monitor = new HostFileChangeMonitor (null);
|
||||
}, "#A4");
|
||||
|
||||
paths.Clear ();
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
monitor = new HostFileChangeMonitor (paths);
|
||||
}, "#A5");
|
||||
}
|
||||
@@ -109,7 +109,7 @@ namespace MonoTests.System.Runtime.Caching
|
||||
// at System.Runtime.Caching.HostFileChangeMonitor.InitDisposableMembers()
|
||||
// at System.Runtime.Caching.HostFileChangeMonitor..ctor(IList`1 filePaths)
|
||||
// at MonoTests.System.Runtime.Caching.HostFileChangeMonitorTest.Constructor_MissingFiles() in c:\users\grendel\documents\visual studio 2010\Projects\System.Runtime.Caching.Test\System.Runtime.Caching.Test\System.Runtime.Caching\HostFileChangeMonitorTest.cs:line 68
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
monitor = new HostFileChangeMonitor (paths);
|
||||
}, "#A1");
|
||||
|
||||
|
@@ -45,69 +45,69 @@ namespace MonoTests.System.Runtime.Caching
|
||||
public void ConstructorParameters ()
|
||||
{
|
||||
MemoryCache mc;
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc = new MemoryCache (null);
|
||||
}, "#A1");
|
||||
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc = new MemoryCache (String.Empty);
|
||||
}, "#A2");
|
||||
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc = new MemoryCache ("default");
|
||||
}, "#A3");
|
||||
|
||||
var config = new NameValueCollection ();
|
||||
config.Add ("CacheMemoryLimitMegabytes", "invalid");
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc = new MemoryCache ("MyCache", config);
|
||||
}, "#A4-1");
|
||||
|
||||
config.Clear ();
|
||||
config.Add ("PhysicalMemoryLimitPercentage", "invalid");
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc = new MemoryCache ("MyCache", config);
|
||||
}, "#A4-2");
|
||||
|
||||
config.Clear ();
|
||||
config.Add ("PollingInterval", "invalid");
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc = new MemoryCache ("MyCache", config);
|
||||
}, "#A4-3");
|
||||
|
||||
config.Clear ();
|
||||
config.Add ("CacheMemoryLimitMegabytes", "-1");
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc = new MemoryCache ("MyCache", config);
|
||||
}, "#A4-4");
|
||||
|
||||
config.Clear ();
|
||||
config.Add ("CacheMemoryLimitMegabytes", UInt64.MaxValue.ToString ());
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc = new MemoryCache ("MyCache", config);
|
||||
}, "#A4-5");
|
||||
|
||||
config.Clear ();
|
||||
config.Add ("PhysicalMemoryLimitPercentage", "-1");
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc = new MemoryCache ("MyCache", config);
|
||||
}, "#A4-6");
|
||||
|
||||
config.Clear ();
|
||||
config.Add ("PhysicalMemoryLimitPercentage", UInt64.MaxValue.ToString ());
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc = new MemoryCache ("MyCache", config);
|
||||
}, "#A4-7");
|
||||
|
||||
config.Clear ();
|
||||
config.Add ("PhysicalMemoryLimitPercentage", UInt32.MaxValue.ToString ());
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc = new MemoryCache ("MyCache", config);
|
||||
}, "#A4-8");
|
||||
|
||||
config.Clear ();
|
||||
config.Add ("PhysicalMemoryLimitPercentage", "-10");
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc = new MemoryCache ("MyCache", config);
|
||||
}, "#A4-9");
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace MonoTests.System.Runtime.Caching
|
||||
|
||||
config.Clear ();
|
||||
config.Add ("PhysicalMemoryLimitPercentage", "101");
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc = new MemoryCache ("MyCache", config);
|
||||
}, "#A4-10");
|
||||
|
||||
@@ -191,15 +191,15 @@ namespace MonoTests.System.Runtime.Caching
|
||||
{
|
||||
var mc = new PokerMemoryCache ("MyCache");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc [null] = "value";
|
||||
}, "#A1-1");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
object v = mc [null];
|
||||
}, "#A1-2");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc ["key"] = null;
|
||||
}, "#A1-3");
|
||||
|
||||
@@ -223,11 +223,11 @@ namespace MonoTests.System.Runtime.Caching
|
||||
{
|
||||
var mc = new PokerMemoryCache ("MyCache");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.Contains (null);
|
||||
}, "#A1-1");
|
||||
|
||||
AssertExtensions.Throws<NotSupportedException> (() => {
|
||||
Assert.Throws<NotSupportedException> (() => {
|
||||
mc.Contains ("key", "region");
|
||||
}, "#A1-2");
|
||||
|
||||
@@ -249,19 +249,19 @@ namespace MonoTests.System.Runtime.Caching
|
||||
{
|
||||
var mc = new PokerMemoryCache ("MyCache");
|
||||
|
||||
AssertExtensions.Throws<NotSupportedException> (() => {
|
||||
Assert.Throws<NotSupportedException> (() => {
|
||||
mc.CreateCacheEntryChangeMonitor (new string [] { "key" }, "region");
|
||||
}, "#A1-1");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.CreateCacheEntryChangeMonitor (null);
|
||||
}, "#A1-2");
|
||||
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc.CreateCacheEntryChangeMonitor (new string [] {});
|
||||
}, "#A1-3");
|
||||
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc.CreateCacheEntryChangeMonitor (new string [] { "key", null });
|
||||
}, "#A1-4");
|
||||
|
||||
@@ -316,15 +316,15 @@ namespace MonoTests.System.Runtime.Caching
|
||||
{
|
||||
var mc = new PokerMemoryCache ("MyCache");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.AddOrGetExisting (null, "value", DateTimeOffset.Now);
|
||||
}, "#A1-1");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.AddOrGetExisting ("key", null, DateTimeOffset.Now);
|
||||
}, "#A1-2");
|
||||
|
||||
AssertExtensions.Throws<NotSupportedException> (() => {
|
||||
Assert.Throws<NotSupportedException> (() => {
|
||||
mc.AddOrGetExisting ("key", "value", DateTimeOffset.Now, "region");
|
||||
}, "#A1-3");
|
||||
|
||||
@@ -350,11 +350,11 @@ namespace MonoTests.System.Runtime.Caching
|
||||
{
|
||||
var mc = new PokerMemoryCache ("MyCache");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.AddOrGetExisting (null, "value", null);
|
||||
}, "#A1-1");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.AddOrGetExisting ("key", null, null);
|
||||
}, "#A1-2");
|
||||
|
||||
@@ -362,29 +362,29 @@ namespace MonoTests.System.Runtime.Caching
|
||||
cip.AbsoluteExpiration = DateTime.Now.AddMinutes (1);
|
||||
cip.SlidingExpiration = TimeSpan.FromMinutes (1);
|
||||
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc.AddOrGetExisting ("key", "value", cip);
|
||||
}, "#A1-3");
|
||||
|
||||
cip = new CacheItemPolicy ();
|
||||
cip.SlidingExpiration = TimeSpan.MinValue;
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException> (() => {
|
||||
Assert.Throws<ArgumentOutOfRangeException> (() => {
|
||||
mc.AddOrGetExisting ("key3", "value", cip);
|
||||
}, "#A1-4");
|
||||
|
||||
AssertExtensions.Throws<NotSupportedException> (() => {
|
||||
Assert.Throws<NotSupportedException> (() => {
|
||||
mc.AddOrGetExisting ("key", "value", null, "region");
|
||||
}, "#A1-5");
|
||||
|
||||
cip = new CacheItemPolicy ();
|
||||
cip.SlidingExpiration = TimeSpan.FromDays (500);
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException> (() => {
|
||||
Assert.Throws<ArgumentOutOfRangeException> (() => {
|
||||
mc.AddOrGetExisting ("key3", "value", cip);
|
||||
}, "#A1-6");
|
||||
|
||||
cip = new CacheItemPolicy ();
|
||||
cip.Priority = (CacheItemPriority) 20;
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException> (() => {
|
||||
Assert.Throws<ArgumentOutOfRangeException> (() => {
|
||||
mc.AddOrGetExisting ("key3", "value", cip);
|
||||
}, "#A1-7");
|
||||
|
||||
@@ -425,7 +425,7 @@ namespace MonoTests.System.Runtime.Caching
|
||||
var mc = new PokerMemoryCache ("MyCache");
|
||||
CacheItem ci, ci2;
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
ci = mc.AddOrGetExisting (null, new CacheItemPolicy ());
|
||||
}, "#A1");
|
||||
|
||||
@@ -448,7 +448,7 @@ namespace MonoTests.System.Runtime.Caching
|
||||
Assert.AreEqual (ci.Value, ci2.Value, "#A3-4");
|
||||
Assert.AreEqual (ci.Key, ci2.Key, "#A3-5");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
ci = new CacheItem (null, "value");
|
||||
ci2 = mc.AddOrGetExisting (ci, null);
|
||||
}, "#A4");
|
||||
@@ -468,14 +468,14 @@ namespace MonoTests.System.Runtime.Caching
|
||||
// at System.Runtime.Caching.MemoryCache.AddOrGetExistingInternal(String key, Object value, CacheItemPolicy policy)
|
||||
// at System.Runtime.Caching.MemoryCache.AddOrGetExisting(CacheItem item, CacheItemPolicy policy)
|
||||
// at MonoTests.System.Runtime.Caching.MemoryCacheTest.AddOrGetExisting_CacheItem_CacheItemPolicy() in C:\Users\grendel\documents\visual studio 2010\Projects\System.Runtime.Caching.Test\System.Runtime.Caching.Test\System.Runtime.Caching\MemoryCacheTest.cs:line 211
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
ci2 = mc.AddOrGetExisting (ci, null);
|
||||
}, "#B1");
|
||||
|
||||
ci = new CacheItem ("key3", "value");
|
||||
var cip = new CacheItemPolicy ();
|
||||
cip.UpdateCallback = (CacheEntryUpdateArguments arguments) => { };
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
ci2 = mc.AddOrGetExisting (ci, cip);
|
||||
}, "#B2");
|
||||
|
||||
@@ -483,14 +483,14 @@ namespace MonoTests.System.Runtime.Caching
|
||||
cip = new CacheItemPolicy ();
|
||||
cip.AbsoluteExpiration = DateTimeOffset.Now;
|
||||
cip.SlidingExpiration = TimeSpan.FromTicks (DateTime.Now.Ticks);
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc.AddOrGetExisting (ci, cip);
|
||||
}, "#B3");
|
||||
|
||||
ci = new CacheItem ("key3", "value");
|
||||
cip = new CacheItemPolicy ();
|
||||
cip.SlidingExpiration = TimeSpan.MinValue;
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException> (() => {
|
||||
Assert.Throws<ArgumentOutOfRangeException> (() => {
|
||||
mc.AddOrGetExisting (ci, cip);
|
||||
}, "#B4-1");
|
||||
|
||||
@@ -503,7 +503,7 @@ namespace MonoTests.System.Runtime.Caching
|
||||
ci = new CacheItem ("key3", "value");
|
||||
cip = new CacheItemPolicy ();
|
||||
cip.SlidingExpiration = TimeSpan.FromDays (500);
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException> (() => {
|
||||
Assert.Throws<ArgumentOutOfRangeException> (() => {
|
||||
mc.AddOrGetExisting (ci, cip);
|
||||
}, "#B5-1");
|
||||
|
||||
@@ -516,7 +516,7 @@ namespace MonoTests.System.Runtime.Caching
|
||||
ci = new CacheItem ("key3", "value");
|
||||
cip = new CacheItemPolicy ();
|
||||
cip.Priority = (CacheItemPriority)20;
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException> (() => {
|
||||
Assert.Throws<ArgumentOutOfRangeException> (() => {
|
||||
mc.AddOrGetExisting (ci, cip);
|
||||
}, "#B6");
|
||||
|
||||
@@ -559,28 +559,28 @@ namespace MonoTests.System.Runtime.Caching
|
||||
{
|
||||
var mc = new PokerMemoryCache ("MyCache");
|
||||
|
||||
AssertExtensions.Throws<NotSupportedException> (() => {
|
||||
Assert.Throws<NotSupportedException> (() => {
|
||||
mc.Set ("key", "value", new CacheItemPolicy (), "region");
|
||||
}, "#A1-1");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.Set (null, "value", new CacheItemPolicy ());
|
||||
}, "#A1-2");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.Set ("key", null, new CacheItemPolicy ());
|
||||
}, "#A1-3");
|
||||
|
||||
var cip = new CacheItemPolicy ();
|
||||
cip.UpdateCallback = (CacheEntryUpdateArguments arguments) => { };
|
||||
cip.RemovedCallback = (CacheEntryRemovedArguments arguments) => { };
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc.Set ("key", "value", cip);
|
||||
}, "#A1-4");
|
||||
|
||||
cip = new CacheItemPolicy ();
|
||||
cip.SlidingExpiration = TimeSpan.MinValue;
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException> (() => {
|
||||
Assert.Throws<ArgumentOutOfRangeException> (() => {
|
||||
mc.Set ("key", "value", cip);
|
||||
}, "#A1-5");
|
||||
|
||||
@@ -591,7 +591,7 @@ namespace MonoTests.System.Runtime.Caching
|
||||
|
||||
cip = new CacheItemPolicy ();
|
||||
cip.SlidingExpiration = TimeSpan.FromDays (500);
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException> (() => {
|
||||
Assert.Throws<ArgumentOutOfRangeException> (() => {
|
||||
mc.Set ("key", "value", cip);
|
||||
}, "#A1-7");
|
||||
|
||||
@@ -602,7 +602,7 @@ namespace MonoTests.System.Runtime.Caching
|
||||
|
||||
cip = new CacheItemPolicy ();
|
||||
cip.Priority = (CacheItemPriority) 20;
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException> (() => {
|
||||
Assert.Throws<ArgumentOutOfRangeException> (() => {
|
||||
mc.Set ("key", "value", cip);
|
||||
}, "#A1-9");
|
||||
|
||||
@@ -635,15 +635,15 @@ namespace MonoTests.System.Runtime.Caching
|
||||
{
|
||||
var mc = new PokerMemoryCache ("MyCache");
|
||||
|
||||
AssertExtensions.Throws<NotSupportedException> (() => {
|
||||
Assert.Throws<NotSupportedException> (() => {
|
||||
mc.Set ("key", "value", DateTimeOffset.MaxValue, "region");
|
||||
}, "#A1-1");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.Set (null, "value", DateTimeOffset.MaxValue);
|
||||
}, "#A1-2");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.Set ("key", null, DateTimeOffset.MaxValue);
|
||||
}, "#A1-3");
|
||||
|
||||
@@ -664,18 +664,18 @@ namespace MonoTests.System.Runtime.Caching
|
||||
{
|
||||
var mc = new PokerMemoryCache ("MyCache");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.Set (null, new CacheItemPolicy ());
|
||||
}, "#A1-1");
|
||||
|
||||
// Actually thrown from the Set (string, object, CacheItemPolicy, string) overload
|
||||
var ci = new CacheItem (null, "value");
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.Set (ci, new CacheItemPolicy ());
|
||||
}, "#A1-2");
|
||||
|
||||
ci = new CacheItem ("key", null);
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.Set (ci, new CacheItemPolicy ());
|
||||
}, "#A1-3");
|
||||
|
||||
@@ -683,14 +683,14 @@ namespace MonoTests.System.Runtime.Caching
|
||||
var cip = new CacheItemPolicy ();
|
||||
cip.UpdateCallback = (CacheEntryUpdateArguments arguments) => { };
|
||||
cip.RemovedCallback = (CacheEntryRemovedArguments arguments) => { };
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc.Set (ci, cip);
|
||||
}, "#A1-4");
|
||||
|
||||
ci = new CacheItem ("key", "value");
|
||||
cip = new CacheItemPolicy ();
|
||||
cip.SlidingExpiration = TimeSpan.MinValue;
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException> (() => {
|
||||
Assert.Throws<ArgumentOutOfRangeException> (() => {
|
||||
mc.Set (ci, cip);
|
||||
}, "#A1-5");
|
||||
|
||||
@@ -703,7 +703,7 @@ namespace MonoTests.System.Runtime.Caching
|
||||
ci = new CacheItem ("key", "value");
|
||||
cip = new CacheItemPolicy ();
|
||||
cip.SlidingExpiration = TimeSpan.FromDays (500);
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException> (() => {
|
||||
Assert.Throws<ArgumentOutOfRangeException> (() => {
|
||||
mc.Set (ci, cip);
|
||||
}, "#A1-7");
|
||||
|
||||
@@ -716,7 +716,7 @@ namespace MonoTests.System.Runtime.Caching
|
||||
ci = new CacheItem ("key", "value");
|
||||
cip = new CacheItemPolicy ();
|
||||
cip.Priority = (CacheItemPriority) 20;
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException> (() => {
|
||||
Assert.Throws<ArgumentOutOfRangeException> (() => {
|
||||
mc.Set (ci, cip);
|
||||
}, "#A1-9");
|
||||
|
||||
@@ -752,11 +752,11 @@ namespace MonoTests.System.Runtime.Caching
|
||||
{
|
||||
var mc = new PokerMemoryCache ("MyCache");
|
||||
|
||||
AssertExtensions.Throws<NotSupportedException> (() => {
|
||||
Assert.Throws<NotSupportedException> (() => {
|
||||
mc.Remove ("key", "region");
|
||||
}, "#A1-1");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.Remove (null);
|
||||
}, "#A1-2");
|
||||
|
||||
@@ -966,15 +966,15 @@ namespace MonoTests.System.Runtime.Caching
|
||||
{
|
||||
var mc = new PokerMemoryCache ("MyCache");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.GetValues ((string[]) null);
|
||||
}, "#A1-1");
|
||||
|
||||
AssertExtensions.Throws<NotSupportedException> (() => {
|
||||
Assert.Throws<NotSupportedException> (() => {
|
||||
mc.GetValues (new string[] {}, "region");
|
||||
}, "#A1-2");
|
||||
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
Assert.Throws<ArgumentException> (() => {
|
||||
mc.GetValues (new string [] { "key", null });
|
||||
}, "#A1-3");
|
||||
|
||||
@@ -1012,11 +1012,11 @@ namespace MonoTests.System.Runtime.Caching
|
||||
{
|
||||
var mc = new PokerMemoryCache ("MyCache");
|
||||
|
||||
AssertExtensions.Throws<NotSupportedException> (() => {
|
||||
Assert.Throws<NotSupportedException> (() => {
|
||||
mc.Get ("key", "region");
|
||||
}, "#A1-1");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.Get (null);
|
||||
}, "#A1-2");
|
||||
|
||||
@@ -1072,11 +1072,11 @@ namespace MonoTests.System.Runtime.Caching
|
||||
{
|
||||
var mc = new PokerMemoryCache ("MyCache");
|
||||
|
||||
AssertExtensions.Throws<NotSupportedException> (() => {
|
||||
Assert.Throws<NotSupportedException> (() => {
|
||||
mc.GetCacheItem ("key", "region");
|
||||
}, "#A1-1");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
mc.GetCacheItem (null);
|
||||
}, "#A1-2");
|
||||
|
||||
@@ -1156,7 +1156,7 @@ namespace MonoTests.System.Runtime.Caching
|
||||
cip.ChangeMonitors.Add (monitor);
|
||||
|
||||
// Thrown by ChangeMonitor.NotifyOnChanged
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
Assert.Throws<InvalidOperationException> (() => {
|
||||
mc.Set ("key1", "value1", cip);
|
||||
}, "#A3");
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ namespace MonoTests.System.Runtime.Caching
|
||||
|
||||
static void Host_SetToNull ()
|
||||
{
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
Assert.Throws<ArgumentNullException> (() => {
|
||||
ObjectCache.Host = null;
|
||||
}, "#A2");
|
||||
}
|
||||
@@ -61,7 +61,7 @@ namespace MonoTests.System.Runtime.Caching
|
||||
Assert.IsNotNull (ObjectCache.Host, "#A3-1");
|
||||
Assert.AreEqual (tns1, ObjectCache.Host, "#A3-2");
|
||||
|
||||
AssertExtensions.Throws<InvalidOperationException> (() => {
|
||||
Assert.Throws<InvalidOperationException> (() => {
|
||||
ObjectCache.Host = tns2;
|
||||
}, "#A4");
|
||||
}
|
||||
|
Reference in New Issue
Block a user