Removed old GetRectangle
RectangleIntersectMinimums AddUserSecrets
This commit is contained in:
@ -39,7 +39,8 @@ public partial class UnitTestCalculations
|
||||
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
|
||||
.AddEnvironmentVariables()
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile(isEnvironment.AppSettingsFileName, optional: false, reloadOnChange: true);
|
||||
.AddJsonFile(isEnvironment.AppSettingsFileName, optional: false, reloadOnChange: true)
|
||||
.AddUserSecrets<UnitTestCalculations>();
|
||||
configurationRoot = configurationBuilder.Build();
|
||||
appSettings = Models.Binder.AppSettings.Get(configurationRoot);
|
||||
if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
|
||||
@ -93,6 +94,7 @@ public partial class UnitTestCalculations
|
||||
throw new NullReferenceException(nameof(age));
|
||||
Assert.IsNotNull(age);
|
||||
Assert.IsTrue(age.Value > 42.6092);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -114,6 +116,7 @@ public partial class UnitTestCalculations
|
||||
Assert.IsTrue($"({l}{d.ToString("0.00")[1..]})" == "(637967784888423594.62)");
|
||||
d = 0.45;
|
||||
Assert.IsTrue($"({l}{d.ToString("0.00")[1..]})" == "(637967784888423594.45)");
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -123,6 +126,7 @@ public partial class UnitTestCalculations
|
||||
Assert.IsTrue(successful == "_ Manual Copy Successful");
|
||||
string verify = $"_ {nameof(Shared.Models.Stateless.IMapLogic.ManualCopy).Humanize(LetterCasing.Title)} Verify";
|
||||
Assert.IsTrue(verify == "_ Manual Copy Verify");
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -154,6 +158,7 @@ public partial class UnitTestCalculations
|
||||
// "7680x4320 - Hog - Large"
|
||||
// [8] [string]:
|
||||
// "()"
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -170,6 +175,7 @@ public partial class UnitTestCalculations
|
||||
Location location = new(bottom, confidence, left, right, top);
|
||||
_ = new Location(confidence, height, location, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, width, 1);
|
||||
_ = new Location(bottom, confidence, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -186,7 +192,7 @@ public partial class UnitTestCalculations
|
||||
width = 100;
|
||||
height = 100;
|
||||
areaPermyriad = IMapping.GetAreaPermyriad(faceAreaPermyriad, bottom, height, left, right, top, width);
|
||||
Assert.IsTrue(areaPermyriad == 1000);
|
||||
Assert.IsTrue(areaPermyriad == 10000);
|
||||
left = 0;
|
||||
right = 50;
|
||||
top = 0;
|
||||
@ -195,7 +201,7 @@ public partial class UnitTestCalculations
|
||||
height = 100;
|
||||
location = new(bottom, confidence, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
|
||||
areaPermyriad = IMapping.GetAreaPermyriad(faceAreaPermyriad, height, location, width);
|
||||
Assert.IsTrue(areaPermyriad == 250);
|
||||
Assert.IsTrue(areaPermyriad == 2500);
|
||||
left = 0;
|
||||
right = 25;
|
||||
top = 0;
|
||||
@ -205,30 +211,8 @@ public partial class UnitTestCalculations
|
||||
location = new(bottom, confidence, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
|
||||
OutputResolution outputResolution = new(height, 0, width);
|
||||
areaPermyriad = IMapping.GetAreaPermyriad(faceAreaPermyriad, location, outputResolution);
|
||||
Assert.IsTrue(areaPermyriad == 62);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestNormalizedRectangle()
|
||||
{
|
||||
int? x, y;
|
||||
int normalizedRectangle;
|
||||
int bottom, height, left, right, top, width;
|
||||
string normalizedRectanglePadded;
|
||||
width = 2048;
|
||||
height = 1365;
|
||||
normalizedRectanglePadded = "617214031";
|
||||
(x, y) = ILocation.GetXY(Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, width, height, normalizedRectanglePadded);
|
||||
if (x is null || y is null)
|
||||
throw new Exception();
|
||||
Assert.IsTrue(x.Value == 1264);
|
||||
Assert.IsTrue(y.Value == 192);
|
||||
left = x.Value;
|
||||
right = x.Value + 125;
|
||||
top = y.Value;
|
||||
bottom = y.Value + 100;
|
||||
normalizedRectangle = ILocation.GetNormalizedRectangle(bottom, height, left, Shared.Models.Stateless.ILocation.Digits, right, top, width);
|
||||
Assert.IsTrue(normalizedRectangle == 461140607);
|
||||
Assert.IsTrue(areaPermyriad == 625);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -241,6 +225,7 @@ public partial class UnitTestCalculations
|
||||
y2 = 10f;
|
||||
double distance = Math.Sqrt(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2));
|
||||
Assert.IsTrue(distance == 1.4142135623730951);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -266,6 +251,7 @@ public partial class UnitTestCalculations
|
||||
value = 1.6f;
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new float[] { minimum, target, maximum }, value);
|
||||
Assert.IsTrue(check == 200);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
Reference in New Issue
Block a user