Removed Configuration.SetAndUpdate
This commit is contained in:
@ -87,22 +87,22 @@ public class UnitTestResize
|
||||
{
|
||||
A_Property result;
|
||||
if (_Configuration?.PropertyConfiguration is null)
|
||||
throw new NullReferenceException(nameof(_Configuration.PropertyConfiguration));
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, _Configuration.OutputExtension, reverse, aResultsFullGroupDirectory);
|
||||
throw new NullReferenceException(nameof(_PropertyConfiguration));
|
||||
result = new(_AppSettings.MaxDegreeOfParallelism, _PropertyConfiguration, _Configuration.OutputExtension, reverse, aResultsFullGroupDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
private (string, string) GetResultsFullGroupDirectories()
|
||||
{
|
||||
string aResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||
_Configuration.PropertyConfiguration,
|
||||
_PropertyConfiguration,
|
||||
nameof(A_Property),
|
||||
string.Empty,
|
||||
includeResizeGroup: false,
|
||||
includeModel: false,
|
||||
includePredictorModel: false);
|
||||
string bResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||
_Configuration.PropertyConfiguration,
|
||||
_PropertyConfiguration,
|
||||
nameof(B_Metadata),
|
||||
string.Empty,
|
||||
includeResizeGroup: false,
|
||||
@ -114,7 +114,7 @@ public class UnitTestResize
|
||||
private (string, string, string) GetResultsFullGroupDirectories(string outputResolution)
|
||||
{
|
||||
string cResultsFullGroupDirectory = Property.Models.Stateless.IResult.GetResultsFullGroupDirectory(
|
||||
_Configuration.PropertyConfiguration,
|
||||
_PropertyConfiguration,
|
||||
nameof(C_Resize),
|
||||
outputResolution,
|
||||
includeResizeGroup: true,
|
||||
@ -128,6 +128,10 @@ public class UnitTestResize
|
||||
[TestMethod]
|
||||
public void TestMethodResize()
|
||||
{
|
||||
if (_PropertyConfiguration.NumberOfJitters is null)
|
||||
throw new NullReferenceException(nameof(_PropertyConfiguration.NumberOfJitters));
|
||||
if (_PropertyConfiguration.NumberOfTimesToUpsample is null)
|
||||
throw new NullReferenceException(nameof(_PropertyConfiguration.NumberOfTimesToUpsample));
|
||||
string sourceFileName = "100000507001158650387.jpg";
|
||||
string sourceDirectoryName = "Facebook/2023.2 Summer Facebook";
|
||||
Item item;
|
||||
@ -144,16 +148,16 @@ public class UnitTestResize
|
||||
bool outputResolutionHasNumber = outputResolution.Any(l => char.IsNumber(l));
|
||||
(string cResultsFullGroupDirectory, _, _) = GetResultsFullGroupDirectories(outputResolution);
|
||||
(string aResultsFullGroupDirectory, string bResultsFullGroupDirectory) = GetResultsFullGroupDirectories();
|
||||
Shared.Models.Methods.IBlurHasher blurHasher = new BlurHash.Models.C2_BlurHasher(_Configuration.PropertyConfiguration);
|
||||
Shared.Models.Methods.IBlurHasher blurHasher = new BlurHash.Models.C2_BlurHasher(_PropertyConfiguration);
|
||||
_Logger.Information(_Configuration.ModelDirectory);
|
||||
A_Property propertyLogic = GetPropertyLogic(reverse, aResultsFullGroupDirectory);
|
||||
string aPropertySingletonDirectory = Path.Combine(aResultsFullGroupDirectory, "{}");
|
||||
if (!Directory.Exists(aPropertySingletonDirectory))
|
||||
_ = Directory.CreateDirectory(aPropertySingletonDirectory);
|
||||
(ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters, string filenameExtension) = C_Resize.GetTuple(_Configuration.OutputExtension, _Configuration.OutputQuality);
|
||||
B_Metadata metadata = new(_Configuration.PropertyConfiguration, _Configuration.ForceMetadataLastWriteTimeToCreationTime, _Configuration.PropertiesChangedForMetadata, bResultsFullGroupDirectory);
|
||||
B_Metadata metadata = new(_PropertyConfiguration, _Configuration.ForceMetadataLastWriteTimeToCreationTime, _Configuration.PropertiesChangedForMetadata, bResultsFullGroupDirectory);
|
||||
_ = metadata.ToString();
|
||||
C_Resize resize = new(_Configuration.PropertyConfiguration, _Configuration.ForceResizeLastWriteTimeToCreationTime, _Configuration.OverrideForResizeImages, _Configuration.PropertiesChangedForResize, _Configuration.ValidResolutions, imageCodecInfo, encoderParameters, filenameExtension);
|
||||
C_Resize resize = new(_PropertyConfiguration, _Configuration.ForceResizeLastWriteTimeToCreationTime, _Configuration.OverrideForResizeImages, _Configuration.PropertiesChangedForResize, _Configuration.ValidResolutions, imageCodecInfo, encoderParameters, filenameExtension);
|
||||
_ = resize.ToString();
|
||||
bool isUniqueFileName = false;
|
||||
bool? isNotUniqueAndNeedsReview = null;
|
||||
@ -182,9 +186,9 @@ public class UnitTestResize
|
||||
item.SetResizedFileHolder(resize.FileNameExtension, resizedFileHolder);
|
||||
MappingFromItem mappingFromItem = IMappingFromItem.GetMappingFromItem(item);
|
||||
(int _, metadataCollection) = metadata.GetMetadataCollection(subFileTuples, parseExceptions, changesFrom, mappingFromItem);
|
||||
Dictionary<string, int[]> outputResolutionToResize = resize.GetResizeKeyValuePairs(_Configuration.PropertyConfiguration, cResultsFullGroupDirectory, subFileTuples, parseExceptions, metadataCollection, item.Property, mappingFromItem);
|
||||
Dictionary<string, int[]> outputResolutionToResize = resize.GetResizeKeyValuePairs(_PropertyConfiguration, cResultsFullGroupDirectory, subFileTuples, parseExceptions, metadataCollection, item.Property, mappingFromItem);
|
||||
Assert.IsNotNull(mappingFromItem.ResizedFileHolder);
|
||||
resize.SaveResizedSubfile(_Configuration.PropertyConfiguration, outputResolution, cResultsFullGroupDirectory, subFileTuples, item, item.Property, mappingFromItem, outputResolutionToResize);
|
||||
resize.SaveResizedSubfile(_PropertyConfiguration, outputResolution, cResultsFullGroupDirectory, subFileTuples, item, item.Property, mappingFromItem, outputResolutionToResize);
|
||||
string blurHash = blurHasher.Encode(resizedFileHolder);
|
||||
Assert.IsNotNull(blurHash);
|
||||
NonThrowTryCatch();
|
||||
|
Reference in New Issue
Block a user