public override void Execute() { var tmpFileName = "file.txt"; var tmpFilePath = Path.GetFullPath(tmpFileName); var beforeText = Guid.NewGuid().ToString(); Console.WriteLine("Before text: " + beforeText); File.WriteAllText(tmpFilePath, beforeText); var ipfs = new ipfsClient(); ipfs.Init(); using (var daemon = ipfs.StartDaemon()) { Thread.Sleep(10000); var hash = ipfs.AddFile(tmpFileName); Console.WriteLine("IPFS Hash: " + hash); var peerId = ipfs.Publish(hash); Console.WriteLine("Peer ID: " + peerId); var fileChecker = new ipfsFileChecker(); fileChecker.CheckTestFile("ipns", peerId, beforeText); var afterText = Guid.NewGuid().ToString(); Console.WriteLine("After text: " + afterText); File.WriteAllText(tmpFilePath, afterText); Thread.Sleep(2000); hash = ipfs.AddFile(tmpFileName); Console.WriteLine("IPFS Hash: " + hash); peerId = ipfs.Publish(hash); Console.WriteLine("Peer ID: " + peerId); fileChecker.CheckTestFile("ipns", peerId, afterText); } }
public override void Execute() { var tmpFileName = "file.txt"; var tmpFilePath = Path.GetFullPath(tmpFileName); var beforeText = Guid.NewGuid().ToString(); Console.WriteLine ("Before text: " + beforeText); File.WriteAllText (tmpFilePath, beforeText); var ipfs = new ipfsClient (); ipfs.Init (); using (var daemon = ipfs.StartDaemon ()) { Thread.Sleep (10000); var hash = ipfs.AddFile (tmpFileName); Console.WriteLine ("IPFS Hash: " + hash); var peerId = ipfs.Publish (hash); Console.WriteLine ("Peer ID: " + peerId); var fileChecker = new ipfsFileChecker (); fileChecker.CheckTestFile ("ipns", peerId, beforeText); var afterText = Guid.NewGuid ().ToString (); Console.WriteLine ("After text: " + afterText); File.WriteAllText (tmpFilePath, afterText); Thread.Sleep (2000); hash = ipfs.AddFile (tmpFileName); Console.WriteLine ("IPFS Hash: " + hash); peerId = ipfs.Publish (hash); Console.WriteLine ("Peer ID: " + peerId); fileChecker.CheckTestFile ("ipns", peerId, afterText); } }
public override void Execute() { // Prepare for the test var tmpFileName = "file.txt"; var tmpFile = Path.GetFullPath(tmpFileName); Console.WriteLine("Tmp file:"); Console.WriteLine(tmpFile); var text = "Hello world"; File.WriteAllText(tmpFile, text); // Start the test var ipfs = new ipfsClient(); ipfs.Init(); using (var daemon = ipfs.StartDaemon()) { // TODO: Fixture out a way to reduce this duration Thread.Sleep(5000); // Sleep to let the daemon start, otherwise an error may occur var hash = ipfs.AddFile(tmpFileName); new ipfsFileChecker().CheckTestFile("ipfs", hash, text); } }