You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UnitTest1.cs 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using System;
  2. using System.Text;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using Microsoft.VisualStudio.TestTools.UnitTesting;
  6. using Novacode;
  7. using System.Diagnostics;
  8. namespace UnitTests
  9. {
  10. /// <summary>
  11. /// Summary description for UnitTest1
  12. /// </summary>
  13. [TestClass]
  14. public class UnitTest1
  15. {
  16. public UnitTest1()
  17. {
  18. TestMethod1();
  19. }
  20. private TestContext testContextInstance;
  21. /// <summary>
  22. ///Gets or sets the test context which provides
  23. ///information about and functionality for the current test run.
  24. ///</summary>
  25. public TestContext TestContext
  26. {
  27. get
  28. {
  29. return testContextInstance;
  30. }
  31. set
  32. {
  33. testContextInstance = value;
  34. }
  35. }
  36. #region Additional test attributes
  37. //
  38. // You can use the following additional attributes as you write your tests:
  39. //
  40. // Use ClassInitialize to run code before running the first test in the class
  41. // [ClassInitialize()]
  42. // public static void MyClassInitialize(TestContext testContext) { }
  43. //
  44. // Use ClassCleanup to run code after all tests in a class have run
  45. // [ClassCleanup()]
  46. // public static void MyClassCleanup() { }
  47. //
  48. // Use TestInitialize to run code before running each test
  49. // [TestInitialize()]
  50. // public void MyTestInitialize() { }
  51. //
  52. // Use TestCleanup to run code after each test has run
  53. // [TestCleanup()]
  54. // public void MyTestCleanup() { }
  55. //
  56. #endregion
  57. [TestMethod]
  58. public void TestMethod1()
  59. {
  60. using (DocX document = DocX.Load(@"C:\Users\cathal\Documents\Visual Studio 2010\Projects\DocX\UnitTests\documents\simple.docx"))
  61. {
  62. Debug.Assert(document.Paragraphs.Count() == 1);
  63. Paragraph p = document.Paragraphs[0];
  64. Debug.Assert(p.Text == "Paragraph 1");
  65. Debug.Assert(p.Pictures.Count == 1);
  66. }
  67. }
  68. }
  69. }