/clients/cs/src/unittests/core/AbstractEntryTest.cs

http://google-gdata.googlecode.com/ · C# · 91 lines · 40 code · 13 blank · 38 comment · 0 complexity · eb21b0d2e576d35c1972ee192438adf1 MD5 · raw file

  1. using Google.GData.Client;
  2. using Google.GData.Calendar;
  3. using NUnit.Framework;
  4. using Google.GData.Client.UnitTests;
  5. using System.Xml;
  6. namespace Google.GData.Client.UnitTests.Core
  7. {
  8. /// <summary>
  9. ///This is a test class for AbstractEntryTest and is intended
  10. ///to contain all AbstractEntryTest Unit Tests
  11. ///</summary>
  12. [TestFixture][Category("CoreClient")]
  13. public class AbstractEntryTest
  14. {
  15. private TestContext testContextInstance;
  16. /// <summary>
  17. ///Gets or sets the test context which provides
  18. ///information about and functionality for the current test run.
  19. ///</summary>
  20. public TestContext TestContext
  21. {
  22. get
  23. {
  24. return testContextInstance;
  25. }
  26. set
  27. {
  28. testContextInstance = value;
  29. }
  30. }
  31. #region Additional test attributes
  32. //
  33. //You can use the following additional attributes as you write your tests:
  34. //
  35. //Use ClassInitialize to run code before running the first test in the class
  36. //[ClassInitialize()]
  37. //public static void MyClassInitialize(TestContext testContext)
  38. //{
  39. //}
  40. //
  41. //Use ClassCleanup to run code after all tests in a class have run
  42. //[ClassCleanup()]
  43. //public static void MyClassCleanup()
  44. //{
  45. //}
  46. //
  47. //Use TestInitialize to run code before running each test
  48. //[TestInitialize()]
  49. //public void MyTestInitialize()
  50. //{
  51. //}
  52. //
  53. //Use TestCleanup to run code after each test has run
  54. //[TestCleanup()]
  55. //public void MyTestCleanup()
  56. //{
  57. //}
  58. //
  59. #endregion
  60. /// <summary>
  61. ///A test for ToggleCategory
  62. ///</summary>
  63. [Test]
  64. public void ToggleCategoryTest()
  65. {
  66. AbstractEntry target = CreateAbstractEntry();
  67. AtomCategory cat = new AtomCategory("testcat");
  68. target.ToggleCategory(cat, true);
  69. Assert.IsTrue(target.Categories.Contains(cat), "Category should now be part of it");
  70. target.ToggleCategory(cat, false);
  71. Assert.IsFalse(target.Categories.Contains(cat), "Category should be gone");
  72. }
  73. internal virtual AbstractEntry CreateAbstractEntry()
  74. {
  75. return new EventEntry();
  76. }
  77. }
  78. }