From 0266c344fb425e1338f988f542fc532e9b47aa1f Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 1 Apr 2009 06:11:51 +0000 Subject: * Added NUnit tested utility function GetHashGuid() for future use. * Did some aligning refactoring of the MD5 and SHA-1 functions. --- OpenSim/Framework/Tests/UtilTest.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'OpenSim/Framework/Tests') diff --git a/OpenSim/Framework/Tests/UtilTest.cs b/OpenSim/Framework/Tests/UtilTest.cs index c5f1800..341cd81 100644 --- a/OpenSim/Framework/Tests/UtilTest.cs +++ b/OpenSim/Framework/Tests/UtilTest.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using NUnit.Framework; using NUnit.Framework.SyntaxHelpers; using OpenMetaverse; @@ -152,5 +153,22 @@ namespace OpenSim.Framework.Tests Assert.IsFalse(Util.isUUID("01234567-89ab-Cdef-0123+456789AbCdEf"), "UUIDs with wrong format are recognized as correct UUIDs."); } + + [Test] + public void GetHashGuidTests() + { + string string1 = "This is one string"; + string string2 = "This is another"; + + // Two consecutive runs should equal the same + Assert.AreEqual(Util.GetHashGuid(string1, "secret1"), Util.GetHashGuid(string1, "secret1")); + Assert.AreEqual(Util.GetHashGuid(string2, "secret1"), Util.GetHashGuid(string2, "secret1")); + + // Varying data should not eqal the same + Assert.AreNotEqual(Util.GetHashGuid(string1, "secret1"), Util.GetHashGuid(string2, "secret1")); + + // Varying secrets should not eqal the same + Assert.AreNotEqual(Util.GetHashGuid(string1, "secret1"), Util.GetHashGuid(string1, "secret2")); + } } } -- cgit v1.1