|
1 | | -using EPPlusImageRenderer.RenderItems; |
2 | | -using EPPlusImageRenderer.RenderItems.Shared; |
3 | | -using EPPlusImageRenderer.Utils; |
4 | | -using OfficeOpenXml; |
5 | | -using OfficeOpenXml.Interfaces.Drawing.Text; |
6 | | -using System; |
7 | | -using System.Collections.Generic; |
8 | | -using System.Linq; |
9 | | -using System.Text; |
10 | | -using System.Threading.Tasks; |
| 1 | +using OfficeOpenXml.Interfaces.Drawing.Text; |
11 | 2 | using EPPlus.Fonts.OpenType; |
12 | 3 | using EPPlus.Fonts.OpenType.Utils; |
13 | | -using System.Security.Cryptography; |
14 | 4 | using EPPlus.Fonts.OpenType.TrueTypeMeasurer.DataHolders; |
15 | 5 |
|
16 | 6 | namespace TestProject1 |
@@ -174,27 +164,28 @@ public void LoremIpsum20Paragraphs() |
174 | 164 |
|
175 | 165 | var savedStrings = SavedComparisonString.Split("\r\n"); |
176 | 166 |
|
177 | | - List<string> differingStrings = new(); |
178 | | - |
179 | | - if (wrappedStrings.Count() > savedStrings.Count()) |
180 | | - differingStrings = savedStrings.Except(wrappedStrings).ToList(); |
181 | | - else |
182 | | - differingStrings = wrappedStrings.Except(savedStrings).ToList(); |
183 | | - |
184 | | - //INTENTIONAL COMMENT for easier debugging later. |
185 | | - //It is sometimes easier to compare files directly when debugging rather than looking through "differingStrings" |
186 | | - //bool writeFiles = true; |
187 | | - |
188 | | - //if (/*differingStrings.Count() > 0*/ writeFiles) |
189 | | - //{ |
190 | | - // File.WriteAllText("C:\\temp\\LoremIpsum20_NEW.txt", string.Join("\r\n", wrappedStrings.ToArray())); |
191 | | - // File.WriteAllText("C:\\temp\\LoremIpsum20_OLD.txt", SavedComparisonString); |
192 | | - |
193 | | - // var currStr = File.ReadAllText("C:\\temp\\LoremIpsum20_NEW.txt"); |
194 | | - // Assert.AreEqual(SavedComparisonString, currStr); |
195 | | - //} |
| 167 | + List<string> faultyStrings = new(); |
| 168 | + List<string> excpectedStrings = new(); |
| 169 | + List<int> indiciesOfDifferingString = new(); |
| 170 | + |
| 171 | + for (int i = 0; i < savedStrings.Count(); i++) |
| 172 | + { |
| 173 | + if(savedStrings[i] != wrappedStrings[i]) |
| 174 | + { |
| 175 | + indiciesOfDifferingString.Add(i); |
| 176 | + faultyStrings.Add(wrappedStrings[i]); |
| 177 | + excpectedStrings.Add(savedStrings[i]); |
| 178 | + } |
| 179 | + } |
| 180 | + |
| 181 | + if(indiciesOfDifferingString.Count != 0) |
| 182 | + { |
| 183 | + //The start of indicies diverging |
| 184 | + Assert.IsNull(indiciesOfDifferingString[0]); |
| 185 | + Assert.AreEqual(faultyStrings[0], excpectedStrings[0]); |
| 186 | + } |
196 | 187 |
|
197 | | - Assert.AreEqual(0, differingStrings.Count()); |
| 188 | + Assert.AreEqual(0, faultyStrings.Count); |
198 | 189 | } |
199 | 190 | [TestMethod] |
200 | 191 | public void LoremIpsum20ParagraphsMultipleFragments() |
|
0 commit comments