PSDTextTests.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.IO;
  3. using Xunit;
  4. namespace PSDTextTests
  5. {
  6. public class PSDTextTests
  7. {
  8. private const string TestFile = "./testFiles/test.psd";
  9. private const string NoTextPSD = "./testFiles/noText.psd";
  10. [Fact]
  11. public void ReadXMLFromPSD()
  12. {
  13. var test = new PSDText.PSDText(TestFile);
  14. Assert.NotEmpty(test.TextData);
  15. }
  16. [Fact]
  17. public void SaveAsXML()
  18. {
  19. var test = new PSDText.PSDText(TestFile);
  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 NoText()
  27. {
  28. Assert.Throws<Exception>(() => new PSDText.PSDText(NoTextPSD));
  29. }
  30. [Fact]
  31. public void SaveAsJSON()
  32. {
  33. var test = new PSDText.PSDText(TestFile);
  34. var destination = "./test.json";
  35. test.SaveAsJSON(destination);
  36. Assert.True(File.Exists(destination));
  37. File.Delete(destination);
  38. }
  39. }
  40. }