/// <summary> /// Gets the unique ID for the test case. /// </summary> private string GetUniqueID(ITestMethod testMethod) { if (testMethod is null) { throw new ArgumentNullException(nameof(testMethod)); } using (var stream = new MemoryStream()) { var assemblyName = testMethod.TestClass.TestCollection.TestAssembly.Assembly.Name; //Get just the assembly name (without version info) when obtained by reflection if (testMethod.TestClass.TestCollection.TestAssembly.Assembly is IReflectionAssemblyInfo assembly) { assemblyName = assembly.Assembly.GetName().Name; } Write(stream, assemblyName); Write(stream, testMethod.TestClass.Class.Name); Write(stream, TestNumber.ToString(CultureInfo.InvariantCulture)); stream.Position = 0; var hash = new byte[20]; var data = stream.ToArray(); var hasher = new Sha1Digest(); hasher.BlockUpdate(data, 0, data.Length); hasher.DoFinal(hash, 0); return(BytesToHexString(hash)); }
/// <summary> /// Gets the unique ID for the test case. /// </summary> protected virtual string GetUniqueID() { using (var stream = new MemoryStream()) { Write(stream, TestMethod.TestClass.TestCollection.TestAssembly.Assembly.Name); Write(stream, TestMethod.TestClass.Class.Name); Write(stream, TestMethod.Method.Name); if (TestMethodArguments != null) { Write(stream, SerializationHelper.Serialize(TestMethodArguments)); } stream.Position = 0; var hash = new byte[20]; var data = stream.ToArray(); var hasher = new Sha1Digest(); hasher.BlockUpdate(data, 0, data.Length); hasher.DoFinal(hash, 0); return(BytesToHexString(hash)); } }
private void CopyIn(Sha1Digest t) { base.CopyIn(t); H1 = t.H1; H2 = t.H2; H3 = t.H3; H4 = t.H4; H5 = t.H5; Array.Copy(t.X, 0, X, 0, t.X.Length); xOff = t.xOff; }
/// <summary> /// Gets the unique ID for the test case. /// </summary> protected virtual string GetUniqueID() { using (var stream = new MemoryStream()) { var assemblyName = TestMethod.TestClass.TestCollection.TestAssembly.Assembly.Name; //Get just the assembly name (without version info) when obtained by reflection IReflectionAssemblyInfo assembly = TestMethod.TestClass.TestCollection.TestAssembly.Assembly as IReflectionAssemblyInfo; if (assembly != null) { assemblyName = assembly.Assembly.GetName().Name; } Write(stream, assemblyName); Write(stream, TestMethod.TestClass.Class.Name); Write(stream, TestMethod.Method.Name); if (TestMethodArguments != null) { Write(stream, SerializationHelper.Serialize(TestMethodArguments)); } var genericTypes = MethodGenericTypes; if (genericTypes != null) { for (var idx = 0; idx < genericTypes.Length; idx++) { Write(stream, TypeUtility.ConvertToSimpleTypeName(genericTypes[idx])); } } stream.Position = 0; var hash = new byte[20]; var data = stream.ToArray(); var hasher = new Sha1Digest(); hasher.BlockUpdate(data, 0, data.Length); hasher.DoFinal(hash, 0); return(BytesToHexString(hash)); } }
/// <summary/> public void Reset(Sha1Digest other) { Sha1Digest d = (Sha1Digest)other; CopyIn(d); }
/** * Copy constructor. This will copy the state of the provided * message digest. */ public Sha1Digest(Sha1Digest t) : base(t) { CopyIn(t); }
/// <summary> /// Gets the unique ID for the test case. /// </summary> protected virtual string GetUniqueID() { using (var stream = new MemoryStream()) { Write(stream, TestMethod.TestClass.TestCollection.TestAssembly.Assembly.Name); Write(stream, TestMethod.TestClass.Class.Name); Write(stream, TestMethod.Method.Name); if (TestMethodArguments != null) Write(stream, SerializationHelper.Serialize(TestMethodArguments)); stream.Position = 0; var hash = new byte[20]; var data = stream.ToArray(); var hasher = new Sha1Digest(); hasher.BlockUpdate(data, 0, data.Length); hasher.DoFinal(hash, 0); return BytesToHexString(hash); } }