PSDTextTests.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System.IO;
  2. using Xunit;
  3. namespace PSDTextTests
  4. {
  5. public class PSDTextTests
  6. {
  7. private const string TestFile = "./testFiles/test.psd";
  8. private const string NoTextPSD = "./testFiles/noText.psd";
  9. [Fact]
  10. public void ReadXMLFromPSD()
  11. {
  12. var test = new PSDText.PSDText(TestFile);
  13. Assert.NotEmpty(test.TextData);
  14. }
  15. [Fact]
  16. public void SaveAsXML()
  17. {
  18. var test = new PSDText.PSDText(TestFile);
  19. Assert.NotEmpty(test.TextData);
  20. var destination = "./test.xml";
  21. test.SaveAsXML(destination);
  22. Assert.True(File.Exists(destination));
  23. File.Delete(destination);
  24. }
  25. [Fact]
  26. public void SaveAsXMLNoText()
  27. {
  28. var test = new PSDText.PSDText(NoTextPSD);
  29. Assert.Empty(test.TextData);
  30. var destination = "./test.xml";
  31. test.SaveAsXML(destination);
  32. Assert.True(File.Exists(destination));
  33. File.Delete(destination);
  34. }
  35. [Fact]
  36. public void SaveAsJSON()
  37. {
  38. var test = new PSDText.PSDText(TestFile);
  39. Assert.NotEmpty(test.TextData);
  40. var destination = "./test.json";
  41. test.SaveAsJSON(destination);
  42. Assert.True(File.Exists(destination));
  43. File.Delete(destination);
  44. }
  45. [Fact]
  46. public void SaveAsJSONNoText()
  47. {
  48. var test = new PSDText.PSDText(NoTextPSD);
  49. Assert.Empty(test.TextData);
  50. var destination = "./test.json";
  51. test.SaveAsJSON(destination);
  52. Assert.True(File.Exists(destination));
  53. File.Delete(destination);
  54. }
  55. }
  56. }