public void GenerateVerifyCode_File_SHA1() { try { System.Utility.Helper.Test tt = new Test(); tt.Start(); var start = GC.GetTotalMemory(false); var path = this.GetTestFile(); var expect = "84114290159D8954715E4C1BA21F7614924F7E27"; var service = new VerifyService(EnumVerifyType.SHA1); var code = service.GenerateVerifyCodeByFile(path); var time = tt.GetElapsedAndStop().TotalMilliseconds; var end = GC.GetTotalMemory(false); service.Dispose(); Assert.IsTrue(expect == code); Console.WriteLine("time:" + time + " ,memory:" + System.Utility.Helper.File.GetFileSize((end - start))); } catch (Exception ex) { Console.WriteLine("There is nothing for the unit test or maybe something wrong in code!"); } }
public void GenerateVerifyCode_File_SHA256() { try { System.Utility.Helper.Test tt = new Test(); tt.Start(); var start = GC.GetTotalMemory(false); var path = this.GetTestFile(); var expect = "DA65745A1951D7239B5E7834319C1722E1F7E9561BC37284C0D5CBD3818DC9BF"; var service = new VerifyService(EnumVerifyType.SHA256); var code = service.GenerateVerifyCodeByFile(path); var time = tt.GetElapsedAndStop().TotalMilliseconds; var end = GC.GetTotalMemory(false); service.Dispose(); Assert.IsTrue(expect == code); Console.WriteLine("time:" + time + " ,memory:" + System.Utility.Helper.File.GetFileSize((end - start))); } catch (Exception) { Console.WriteLine("There is nothing for the unit test or maybe something wrong in code!"); } System.IO.File.Delete(@"D:\TFS.txt"); }