public void NTestGetHashFiles() { Dublicates d = new Dublicates(targetbackUp, currentData); d.GetHashFiles(path); Assert.IsNotEmpty(targetbackUp); }
public void NTestGetHashMD5File() { string textData = Path.Combine("TestData", "1.txt"); Dublicates d = new Dublicates(path, currentData); object[] args = new object[1]; args[0] = CurrentDirectory + "\\" + textData; MethodInfo methodInfo = typeof(Dublicates).GetMethod("GetHashMD5File", BindingFlags.NonPublic | BindingFlags.Instance); var md = methodInfo.Invoke(d, args); Assert.IsNotNull(md); }
static void Main(string[] args) { if (Directory.Exists(targetbackUp)) { // d.RemoveBack_Up(targetbackUp); } // we can use IDublicates and IDublicates as references in order to encapsulation of RemoveBack_Up method. Dublicates dublicates = new Dublicates(); dublicates.MoveFiles(rootPath); Console.WriteLine("All dublicate files have saved"); Console.ReadKey(); }
public void NTestExceptionCreateDirectory() { Dublicates d = new Dublicates(path, currentData); object[] args = new object[2]; args[0] = null; args[1] = null; MethodInfo methodInfo = typeof(Dublicates).GetMethod("CreateDirectory", BindingFlags.NonPublic | BindingFlags.Instance); Assert.Catch <TargetInvocationException>(() => methodInfo.Invoke(d, args)); Assert.Catch <Exception>(() => methodInfo.Invoke(d, args)); }
public void NTestCreateDirectory() { string directory = "ttttt"; Dublicates d = new Dublicates(path, currentData); object[] args = new object[2]; args[0] = path; args[1] = directory; MethodInfo methodInfo = typeof(Dublicates).GetMethod("CreateDirectory", BindingFlags.NonPublic | BindingFlags.Instance); string dir = (string)methodInfo.Invoke(d, args); Assert.IsNotEmpty(dir); Assert.AreEqual(dir, path + "\\" + directory); }