Browse Source

Added TotalCharacters

Piotr Czajkowski 3 years ago
parent
commit
8eb8baa3b0
2 changed files with 24 additions and 1 deletions
  1. 9 1
      memoQAnalysis/MemoQAnalysis.cs
  2. 15 0
      memoQAnalysisTests/AnalysisTests.cs

+ 9 - 1
memoQAnalysis/MemoQAnalysis.cs

@@ -273,7 +273,15 @@ namespace memoQAnalysis
         }
 
         [Index(84)]
-        public int TotalCharacters { get; set; }
+        public int TotalCharacters {
+            get
+            {
+                var total = XtranslatedCharacters + HundredOneCharacters + RepetitionsCharacters + HundredCharacters +
+                            NinentyFiveNineCharacters + EightyFiveNinentyFourCharacters + SeventyFiveEightyFourCharacters +
+                            FiftySeventyFourCharacters + NoMatchCharacters + FragmentsCharacters;
+                return total;
+            }
+        }
 
         [Index(85)]
         public int TotalAsianCharacters { get; set; }

+ 15 - 0
memoQAnalysisTests/AnalysisTests.cs

@@ -84,6 +84,21 @@ namespace memoQAnalysisTests
             Assert.Equal(expectedTotal, newTotal);
         }
 
+        [Fact]
+        public void TotalCharacters()
+        {
+            var test = new Analysis(MainTestFile);
+            var total = test.Data.Sum(x => x.TotalCharacters);
+
+            var originalFirstFile = test.Data.FirstOrDefault();
+            Assert.NotNull(originalFirstFile);
+            originalFirstFile.RepetitionsCharacters += 1050;
+
+            var expectedTotal = total + 1050;
+            var newTotal = test.Data.Sum(x => x.TotalCharacters);
+            Assert.Equal(expectedTotal, newTotal);
+        }
+
         [Fact]
         public void ReadModifySaveCheck()
         {