Library/Library.Test/TestSalt.cs
C# | Copy Code |
---|---|
Salt s = new Salt(); byte[] bytes = new byte[s.Length]; s.CopyTo(bytes, 0); Assert.AreEqual(s.ToArray(), bytes); Assert.AreEqual(s.GetHashCode(), Salt.FromBytes(bytes).GetHashCode()); Salt strcpy = Salt.FromString(s.ToString()); Assert.AreEqual(s.ToArray(), strcpy.ToArray()); Assert.AreEqual(s.ToString(), strcpy.ToString()); Assert.AreEqual(s.GetHashCode(), strcpy.GetHashCode()); |
VB.NET | Copy Code |
---|---|
Dim s As New Salt() Dim bytes As Byte() = New Byte(s.Length) {} s.CopyTo(bytes, 0) Assert.AreEqual(s.ToArray(), bytes) Assert.AreEqual(s.GetHashCode(), Salt.FromBytes(bytes).GetHashCode()) Dim strcpy As Salt = Salt.FromString(s.ToString()) Assert.AreEqual(s.ToArray(), strcpy.ToArray()) Assert.AreEqual(s.ToString(), strcpy.ToString()) Assert.AreEqual(s.GetHashCode(), strcpy.GetHashCode()) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7