Tests passed using Mock
This commit is contained in:
@ -143,10 +143,10 @@ public class AttachmentsService : IAttachmentsService
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
continue;
|
||||
files.AddRange(Directory.GetFiles(checkDirectory));
|
||||
if (files.Any())
|
||||
if (files.Count != 0)
|
||||
break;
|
||||
}
|
||||
result = !files.Any() ? null : files.First();
|
||||
result = files.Count == 0 ? null : files.First();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Adaptation.FileHandlers.json;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
@ -95,7 +96,7 @@ public class SpreadingResistanceProfileService : ISpreadingResistanceProfileServ
|
||||
return rectangles.ToArray();
|
||||
}
|
||||
|
||||
private static string[] GetRectanglesDescriptions(Info info, Setup setup, List<Layer> layers)
|
||||
private static ReadOnlyCollection<string> GetRectanglesDescriptions(Info info, Setup setup, List<Layer> layers)
|
||||
{
|
||||
List<string> results = new()
|
||||
{
|
||||
@ -123,7 +124,7 @@ public class SpreadingResistanceProfileService : ISpreadingResistanceProfileServ
|
||||
_ = stringBuilder.AppendLine(string.Concat("First Pt. ", layer.FirstPoint, " Last Pt. ", layer.LastPoint, " Type ", layer.Type, " Smoothing ", layer.Smoothing, " Correction ", layer.Correction));
|
||||
_ = stringBuilder.AppendLine(string.Join(" ", info.Comments));
|
||||
results[0] = stringBuilder.ToString();
|
||||
return results.ToArray();
|
||||
return new(results);
|
||||
}
|
||||
|
||||
internal static byte[] GetImageBytes(CSV csv)
|
||||
@ -182,8 +183,8 @@ public class SpreadingResistanceProfileService : ISpreadingResistanceProfileServ
|
||||
graphics.FillRectangles(Brushes.White, rectangles);
|
||||
graphics.DrawRectangles(pen, rectangles);
|
||||
|
||||
string[] descriptions = GetRectanglesDescriptions(csv.Info, csv.Setup, csv.LayerHeader.Layers);
|
||||
for (int i = 0; i < descriptions.Length; i++)
|
||||
ReadOnlyCollection<string> descriptions = GetRectanglesDescriptions(csv.Info, csv.Setup, csv.LayerHeader.Layers);
|
||||
for (int i = 0; i < descriptions.Count; i++)
|
||||
graphics.DrawString(descriptions[i], consolas, brush, rectangles[i]);
|
||||
|
||||
DrawLine(graphics, concentrationPen, 13, 6, 13, 40);
|
||||
|
@ -35,7 +35,7 @@ public class CSV
|
||||
# else
|
||||
string[] lines = File.ReadAllLines(path, System.Text.Encoding.GetEncoding("ISO-8859-1")); // µ³®
|
||||
# endif
|
||||
string? fileVersion = !lines.Any() ? null : GetFileVersion(lines.First());
|
||||
string? fileVersion = lines.Length == 0 ? null : GetFileVersion(lines.First());
|
||||
for (int i = 1; i < lines.Length; i++)
|
||||
{
|
||||
if (lines[i].StartsWith("--INFO--"))
|
||||
|
Reference in New Issue
Block a user