Ejemplo n.º 1
0
        public static void TestGoogleImageQuerySimple()
        {
            GoogleImageQuery query = new GoogleImageQuery();

            GoogleImageQuery.ImageResult result = query.Query("apple");
            UnitTest.Test(result.Url == "http://appleadayproject.files.wordpress.com/2011/03/apple-full2.jpg");
            UnitTest.Test(result.Image.Length == 10700);
        }
Ejemplo n.º 2
0
        public static void TestExtractUrl()
        {
            string input = @"/imgres?imgurlx3dhttp://appleadayproject.files.wordpress.com/2011/03/apple-full2.jpg\x26imgrefurl\x3dhttp://appleadayproject.wordpress.com/\x26usg\x3d__Ag_Gx3aDDpaGDDtq3Os5XmavEAo\x3d\x26h\x3d348\x26w\x3d345\x26sz\x3d11\x26hl\x3den\x26start\x3d1\x26zoom\x3d1\x26um\x3d1\x26itbs\x3d1";

            string expected = "http://appleadayproject.files.wordpress.com/2011/03/apple-full2.jpg";
            string actual   = GoogleImageQuery.ExtractUrl(input);

            UnitTest.Test(expected == actual);
        }