/src/AddIns/Misc/PackageManagement/Test/Src/OpenHyperlinkCommandTests.cs

https://github.com/ajadex/SharpDevelop · C# · 66 lines · 40 code · 9 blank · 17 comment · 0 complexity · b845d0a4a424e243d393341e1752dcaf MD5 · raw file

  1. // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
  2. //
  3. // Permission is hereby granted, free of charge, to any person obtaining a copy of this
  4. // software and associated documentation files (the "Software"), to deal in the Software
  5. // without restriction, including without limitation the rights to use, copy, modify, merge,
  6. // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  7. // to whom the Software is furnished to do so, subject to the following conditions:
  8. //
  9. // The above copyright notice and this permission notice shall be included in all copies or
  10. // substantial portions of the Software.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  13. // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  14. // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
  15. // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  17. // DEALINGS IN THE SOFTWARE.
  18. using System;
  19. using ICSharpCode.PackageManagement;
  20. using PackageManagement.Tests.Helpers;
  21. using NUnit.Framework;
  22. namespace PackageManagement.Tests
  23. {
  24. [TestFixture]
  25. public class OpenHyperlinkCommandTests
  26. {
  27. TestableOpenHyperlinkCommand command;
  28. void CreateOpenHyperlinkCommand()
  29. {
  30. command = new TestableOpenHyperlinkCommand();
  31. }
  32. [Test]
  33. public void CanExecute_NullParameterPassed_ReturnsTrue()
  34. {
  35. CreateOpenHyperlinkCommand();
  36. bool result = command.CanExecute(null);
  37. Assert.IsTrue(result);
  38. }
  39. [Test]
  40. public void Execute_HyperlinkStringPassedAsParameter_StartProcessPassedHyperlink()
  41. {
  42. CreateOpenHyperlinkCommand();
  43. string hyperlink = "http://sharpdevelop.com";
  44. command.Execute(hyperlink);
  45. Assert.AreEqual(hyperlink, command.FileNamePassedToStartProcessMethod);
  46. }
  47. [Test]
  48. public void Execute_UriPassedAsParameter_StartProcessPassedHyperlink()
  49. {
  50. CreateOpenHyperlinkCommand();
  51. string hyperlink = "http://sharpdevelop.com/";
  52. Uri uri = new Uri(hyperlink);
  53. command.Execute(uri);
  54. Assert.AreEqual(hyperlink, command.FileNamePassedToStartProcessMethod);
  55. }
  56. }
  57. }