AnalysisTests.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System.IO;
  2. using memoQAnalysis;
  3. using Xunit;
  4. namespace memoQAnalysisTests
  5. {
  6. public class AnalysisTests
  7. {
  8. private const string MainTestFile = "./testFiles/utf8.csv";
  9. private const string UTF16TestFile = "./testFiles/utf16.csv";
  10. private const string UTF16NoHeaderTestFile = "./testFiles/utf16NoHeader.csv";
  11. [Fact]
  12. public void ReadAnalysisUTF8Comma()
  13. {
  14. var test = new Analysis(MainTestFile);
  15. Assert.Equal(3, test.Data.Count);
  16. }
  17. [Fact]
  18. public void ReadAnalysisUTF16Semicolon()
  19. {
  20. var test = new Analysis(UTF16TestFile, ";");
  21. Assert.Equal(3, test.Data.Count);
  22. }
  23. [Fact]
  24. public void ReadAnalysisUTF16SemicolonNoHeader()
  25. {
  26. var test = new Analysis(UTF16NoHeaderTestFile, ";");
  27. Assert.Equal(3, test.Data.Count);
  28. }
  29. [Fact]
  30. public void WordsToTranslateWithoutRepetitions()
  31. {
  32. var test = new Analysis(MainTestFile);
  33. Assert.Equal(0, test.WordsToTranslateWithoutRepetitions());
  34. }
  35. [Fact]
  36. public void WordsToTranslateWithRepetitions()
  37. {
  38. var test = new Analysis(MainTestFile);
  39. Assert.Equal(601, test.WordsToTranslateWithRepetitions());
  40. }
  41. [Fact]
  42. public void ReadAnalysisFromBytes()
  43. {
  44. var data = File.ReadAllBytes(UTF16TestFile);
  45. var test = new Analysis(data);
  46. Assert.Equal(3, test.Data.Count);
  47. }
  48. }
  49. }