/Tests.cs

https://github.com/brigand/twiddlekins · C# · 60 lines · 49 code · 11 blank · 0 comment · 9 complexity · a572d676b6074b1bf64eac2825d83094 MD5 · raw file

  1. using System;
  2. using System.Diagnostics;
  3. using System.Security;
  4. using System.Web.Services;
  5. using robokins.Utility;
  6. using robokins.Utility.Search;
  7. namespace robokins
  8. {
  9. partial class Program
  10. {
  11. [Conditional("DEBUG")]
  12. static void Tests(SecureString password)
  13. {
  14. string[] defs;
  15. string def;
  16. defs = Wiki.Search("test");
  17. Console.WriteLine("Wiki: {0}", defs == null ? "null" : string.Join(" ", defs));
  18. Console.WriteLine();
  19. defs = Google.AutoHotkey("foobar");
  20. Console.WriteLine("Google AutoHotkey: {0}", defs == null ? "null" : string.Join(" ", defs));
  21. Console.WriteLine();
  22. defs = Google.Search("meaning of life");
  23. Console.WriteLine("Google Search: {0}", defs == null ? "null" : string.Join(" ", defs));
  24. Console.WriteLine();
  25. Console.WriteLine("Google Define: {0}", Google.Define("test") ?? "null");
  26. Console.WriteLine();
  27. defs = MSDN.Search("createwindow");
  28. Console.WriteLine("MSDN: {0}", defs == null ? "null" : string.Join(" ", defs));
  29. Console.WriteLine();
  30. def = UrbanDictionary.Search("windows");
  31. Console.WriteLine("UrbanDictionary: {0}", def);
  32. Console.WriteLine();
  33. def = HTTP.ShortUrl("http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=louth&sll=53.800651,-4.064941&sspn=33.219383,38.803711&ie=UTF8&hq=&hnear=Louth,+United+Kingdom&ll=53.370272,-0.004034&spn=0.064883,0.075788&z=14");
  34. Console.WriteLine("Short URL: {0}", def);
  35. Console.WriteLine();
  36. def = "dllcall()";
  37. defs = Manual.Lookup(def);
  38. Console.WriteLine("Manual \"{0}\": {1}: {2}", def, defs[0], defs[1]);
  39. def = "nothing";
  40. Console.WriteLine("Manual \"{0}\": {1}", def, Manual.Lookup(def) == null ? "null" : "not null");
  41. Console.WriteLine();
  42. Console.WriteLine();
  43. Console.Write("Connect to IRC [y/n]? ");
  44. char mode = (char)Console.Read();
  45. if (!(mode == 'y' || mode == 'Y'))
  46. Environment.Exit(0);
  47. }
  48. }
  49. }