Fix tests
This commit is contained in:
@@ -126,8 +126,8 @@ namespace Umbraco.Core.Sync
|
||||
public static string GetServerHash(string machineName, string appDomainAppId)
|
||||
{
|
||||
var hasher = new HashCodeCombiner();
|
||||
hasher.AddCaseInsensitiveString(NetworkHelper.MachineName);
|
||||
hasher.AddCaseInsensitiveString(System.Web.HttpRuntime.AppDomainAppId);
|
||||
hasher.AddCaseInsensitiveString(appDomainAppId);
|
||||
hasher.AddCaseInsensitiveString(machineName);
|
||||
return hasher.GetCombinedHashCode();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Sync;
|
||||
using umbraco.presentation.webservices;
|
||||
@@ -9,16 +10,22 @@ namespace Umbraco.Tests.Cache
|
||||
{
|
||||
[TestCase("", "123456", "testmachine", true)] //empty hash will continue
|
||||
[TestCase("fffffff28449cf33", "123456", "testmachine", false)] //match, don't continue
|
||||
[TestCase("fffffff28449cf33", "12345", "testmachine", true)]
|
||||
[TestCase("fffffff28449cf33", "123456", "testmachin", true)]
|
||||
[TestCase("fffffff28449cf3", "123456", "testmachine", true)]
|
||||
[TestCase("fffffff28449cf33", "12345", "testmachine", true)] // no match, continue
|
||||
[TestCase("fffffff28449cf33", "123456", "testmachin", true)] // same
|
||||
[TestCase("fffffff28449cf3", "123456", "testmachine", true)] // same
|
||||
public void Continue_Refreshing_For_Request(string hash, string appDomainAppId, string machineName, bool expected)
|
||||
{
|
||||
if (expected)
|
||||
Assert.AreEqual(hash, WebServiceServerMessenger.GetServerHash(appDomainAppId, machineName));
|
||||
Assert.IsTrue(Continue(hash, WebServiceServerMessenger.GetServerHash(appDomainAppId, machineName)));
|
||||
else
|
||||
Assert.AreNotEqual(hash, WebServiceServerMessenger.GetServerHash(appDomainAppId, machineName));
|
||||
Assert.IsFalse(Continue(hash, WebServiceServerMessenger.GetServerHash(appDomainAppId, machineName)));
|
||||
}
|
||||
|
||||
// that's what CacheRefresher.asmx.cs does...
|
||||
private bool Continue(string hash1, string hash2)
|
||||
{
|
||||
if (string.IsNullOrEmpty(hash1)) return true;
|
||||
return hash1 != hash2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ namespace umbraco.presentation.webservices
|
||||
// in which case we should ignore the message because it's been processed locally already
|
||||
internal static bool SelfMessage(string hash)
|
||||
{
|
||||
if (string.IsNullOrEmpty(hash)) return false; // no hash = don't know = not self
|
||||
if (hash != WebServiceServerMessenger.GetCurrentServerHash()) return false;
|
||||
|
||||
LogHelper.Debug<CacheRefresher>(
|
||||
|
||||
Reference in New Issue
Block a user