Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -124,6 +124,7 @@ namespace MonoTests.System.Runtime.Caching
Assert.AreEqual (1, monitor.FilePaths.Count, "#A2-1");
Assert.AreEqual (missingFile, monitor.FilePaths [0], "#A2-2");
Assert.AreEqual (missingFile + "701CE1722770000FFFFFFFFFFFFFFFF", monitor.UniqueId, "#A2-4");
monitor.Dispose ();
paths.Add (missingFile);
monitor = new HostFileChangeMonitor (paths);
@@ -131,6 +132,7 @@ namespace MonoTests.System.Runtime.Caching
Assert.AreEqual (missingFile, monitor.FilePaths [0], "#A3-2");
Assert.AreEqual (missingFile, monitor.FilePaths [1], "#A3-3");
Assert.AreEqual (missingFile + "701CE1722770000FFFFFFFFFFFFFFFF", monitor.UniqueId, "#A3-4");
monitor.Dispose ();
}
[Test]
@@ -153,11 +155,12 @@ namespace MonoTests.System.Runtime.Caching
// Just checks if it doesn't throw any exception for dupes
monitor = new HostFileChangeMonitor (paths);
monitor.Dispose ();
}
static Tuple <string, string, string, IList <string>> SetupMonitoring ()
{
string testPath = Path.Combine (Path.GetTempPath (), "Dispose_Calls_StopMonitoring");
string testPath = Path.Combine (Path.GetTempPath (), "HostFileChangeMonitorTest", "Dispose_Calls_StopMonitoring");
if (!Directory.Exists (testPath))
Directory.CreateDirectory (testPath);
@@ -297,6 +300,7 @@ namespace MonoTests.System.Runtime.Caching
list.Add (setup.Item1);
monitor = new HostFileChangeMonitor (list);
Assert.AreEqual (sb.ToString (), monitor.UniqueId, "#A3");
monitor.Dispose ();
} finally {
CleanupMonitoring (setup);
}

View File

@@ -133,7 +133,6 @@ namespace MonoTests.System.Runtime.Caching
{
var mc = new MemoryCache ("MyCache");
Assert.AreEqual ("MyCache", mc.Name, "#A1");
Assert.AreEqual (98, mc.PhysicalMemoryLimit, "#A2");
// Value of this property is different from system to system
//Assert.AreEqual (0, mc.CacheMemoryLimit, "#A3");
Assert.AreEqual (TimeSpan.FromMinutes (2), mc.PollingInterval, "#A4");
@@ -152,7 +151,6 @@ namespace MonoTests.System.Runtime.Caching
{
var mc = MemoryCache.Default;
Assert.AreEqual ("Default", mc.Name, "#A1");
Assert.AreEqual (98, mc.PhysicalMemoryLimit, "#A2");
// Value of this property is different from system to system
//Assert.AreEqual (0, mc.CacheMemoryLimit, "#A3");
Assert.AreEqual (TimeSpan.FromMinutes (2), mc.PollingInterval, "#A4");
@@ -170,12 +168,10 @@ namespace MonoTests.System.Runtime.Caching
public void ConstructorValues ()
{
var config = new NameValueCollection ();
config.Add ("PhysicalMemoryLimitPercentage", "0");
config.Add ("CacheMemoryLimitMegabytes", "1");
config.Add ("pollingInterval", "00:10:00");
var mc = new MemoryCache ("MyCache", config);
Assert.AreEqual (98, mc.PhysicalMemoryLimit, "#A1");
Assert.AreEqual (1048576, mc.CacheMemoryLimit, "#A2");
Assert.AreEqual (TimeSpan.FromMinutes (10), mc.PollingInterval, "#A3");
@@ -1225,12 +1221,8 @@ namespace MonoTests.System.Runtime.Caching
Assert.AreEqual (25, trimmed, "#A4-2");
Assert.AreEqual (25, removed.Count, "#A4-3");
// OK, this is odd... The list is correct in terms of entries removed but the entries
// are removed in the _MOST_ frequently used order, within the group selected for removal.
for (int i = 24; i >= 0; i--) {
int idx = 24 - i;
Assert.AreEqual ("key" + i.ToString (), removed [idx], "#A5-" + idx.ToString ());
}
for (int i = 0; i < 25; i++)
Assert.AreEqual ("key" + i.ToString (), removed [i], "#A5-" + i.ToString ());
}
[Test]
@@ -1377,7 +1369,10 @@ namespace MonoTests.System.Runtime.Caching
Assert.AreEqual (0, mc.GetCount (), "#CSL1");
var cip = new CacheItemPolicy();
cip.SlidingExpiration = new TimeSpan (0, 0, 1);
// The sliding expiration timeout has to be greater than 1 second because
// .NET implementation ignores timeouts updates smaller than
// CacheExpires.MIN_UPDATE_DELTA which is equal to 1.
cip.SlidingExpiration = new TimeSpan (0, 0, 2);
mc.Add("slidingtest", "42", cip);
mc.Add("expire1", "1", cip);