public void Should_Show_Inexistant_Url() { string[] args = new string[]{"get","-url","http://google.fr"}; string theUrl=args[2]; var n=new NURL(theUrl); theUrl=n.AddHttp(theUrl); bool isExist=n.ExistURL(theUrl); Assert.IsTrue(isExist,"<h1>You're entered a fake url</h1>"); }
public void Should_Display_Content() { string[] args = new string[]{"get","-url","http://gaara-fr.com"}; //SaveContent string theUrl=args[2]; var n=new NURL(theUrl); var gn=new GetNURL(n); string content=gn.GetDisplayHtml(theUrl); Assert.AreEqual(content,gn.GetDisplayHtml(theUrl)); }
public void Should_Create_File_And_Fill() { string[] args = new string[]{"get","-url","http://gaara-fr.com","-save",@"C:\Users\Aroune\gaara.txt"}; //SaveContent string theUrl=args[2]; string path=args[4]; var n=new NURL(theUrl); var gn=new GetNURL(n); gn.SaveContent(theUrl,path); Assert.IsTrue(File.Exists(args[4])); string content; using(FileStream fs = new FileStream(args[4],FileMode.Open)){ using(StreamReader sr = new StreamReader(fs)){ content = sr.ReadToEnd(); } } Assert.IsNotNullOrEmpty(content); }