NullReferenceException

This commit is contained in:
2022-08-13 11:19:08 -07:00
parent 3aeab88384
commit 0392de1920
33 changed files with 1278 additions and 1030 deletions

View File

@ -72,14 +72,14 @@ public class UnitTestResize
Assert.IsFalse(_PropertyConfiguration is null);
}
private Property.Models.PropertyLogic GetPropertyLogic()
private Property.Models.PropertyLogic GetPropertyLogic(bool reverse, Model? model, PredictorModel? predictorModel)
{
Property.Models.PropertyLogic result;
if (_AppSettings.MaxDegreeOfParallelism is null)
throw new ArgumentNullException(nameof(_AppSettings.MaxDegreeOfParallelism));
throw new NullReferenceException(nameof(_AppSettings.MaxDegreeOfParallelism));
if (_Configuration?.PropertyConfiguration is null)
throw new ArgumentNullException(nameof(_Configuration.PropertyConfiguration));
result = new(_AppSettings.MaxDegreeOfParallelism.Value, _Configuration.PropertyConfiguration);
throw new NullReferenceException(nameof(_Configuration.PropertyConfiguration));
result = new(_AppSettings.MaxDegreeOfParallelism.Value, _Configuration.PropertyConfiguration, reverse, model, predictorModel);
return result;
}
@ -91,31 +91,31 @@ public class UnitTestResize
string sourceFileName = "Fall 2005 (113).jpg";
string sourceDirectoryName = "=2005.3 Fall";
if (_Configuration.ForceMetadataLastWriteTimeToCreationTime is null)
throw new ArgumentNullException(nameof(_Configuration.ForceMetadataLastWriteTimeToCreationTime));
throw new NullReferenceException(nameof(_Configuration.ForceMetadataLastWriteTimeToCreationTime));
if (_Configuration.ForceResizeLastWriteTimeToCreationTime is null)
throw new ArgumentNullException(nameof(_Configuration.ForceResizeLastWriteTimeToCreationTime));
throw new NullReferenceException(nameof(_Configuration.ForceResizeLastWriteTimeToCreationTime));
if (_Configuration.OutputQuality is null)
throw new ArgumentNullException(nameof(_Configuration.OutputQuality));
throw new NullReferenceException(nameof(_Configuration.OutputQuality));
if (_Configuration.OverrideForResizeImages is null)
throw new ArgumentNullException(nameof(_Configuration.OverrideForResizeImages));
throw new NullReferenceException(nameof(_Configuration.OverrideForResizeImages));
if (_Configuration.PropertiesChangedForMetadata is null)
throw new ArgumentNullException(nameof(_Configuration.PropertiesChangedForMetadata));
throw new NullReferenceException(nameof(_Configuration.PropertiesChangedForMetadata));
if (_Configuration.PropertiesChangedForResize is null)
throw new ArgumentNullException(nameof(_Configuration.PropertiesChangedForResize));
int g = 1;
int r = 1;
throw new NullReferenceException(nameof(_Configuration.PropertiesChangedForResize));
Model? model = null;
bool reverse = false;
Property.Models.Item item;
string original = "Original";
List<string> parseExceptions = new();
PredictorModel? predictorModel = null;
bool isValidImageFormatExtension = true;
Property.Models.A_Property? property = null;
Property.Models.PropertyHolder propertyHolder;
Dictionary<string, int[]> imageResizeKeyValuePairs;
List<Tuple<string, DateTime>> subFileTuples = new();
PredictorModel? predictorModel = null;
List<KeyValuePair<string, string>> metadataCollection;
int length = _PropertyConfiguration.RootDirectory.Length;
string outputResolution = _Configuration.OutputResolutions[0];
Property.Models.PropertyLogic propertyLogic = GetPropertyLogic();
Property.Models.PropertyLogic propertyLogic = GetPropertyLogic(reverse, model, predictorModel);
string sourceDirectory = Path.Combine(_PropertyConfiguration.RootDirectory, sourceDirectoryName);
string aPropertySingletonDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(_PropertyConfiguration, nameof(Property.Models.A_Property), "{}");
B_Metadata metadata = new(_Configuration.ForceMetadataLastWriteTimeToCreationTime.Value, _Configuration.PropertiesChangedForMetadata.Value);
@ -161,15 +161,15 @@ public class UnitTestResize
Property.Models.FileHolder fileHolder = new(Path.Combine(sourceDirectory, sourceFileName));
string relativePath = Property.Models.Stateless.IPath.GetRelativePath(fileHolder.FullName, length);
sourceDirectory = Path.Combine(aPropertySingletonDirectory, sourceDirectoryName);
propertyHolder = new(g, sourceDirectory, sourceDirectoryFile, relativePath, r, fileHolder, property, false, false, null, null);
Assert.IsNotNull(propertyHolder.ImageFileHolder);
property = propertyLogic.GetProperty(propertyLogic.AngleBracketCollection[0], propertyHolder, subFileTuples, parseExceptions);
(int _, metadataCollection) = metadata.GetMetadataCollection(subFileTuples, parseExceptions, propertyHolder);
imageResizeKeyValuePairs = resize.GetResizeKeyValuePairs(subFileTuples, parseExceptions, original, metadataCollection, property, propertyHolder);
Property.Models.FileHolder resizedFileHolder = new(Path.Combine(resize.AngleBracketCollection[0].Replace("<>", "()"), Path.GetFileName(propertyHolder.ImageFileHolder.FullName)));
propertyHolder.SetResizedFileHolder(resizedFileHolder);
resize.SaveResizedSubfile(outputResolution, subFileTuples, propertyHolder, original, property, imageResizeKeyValuePairs);
propertyHolder.SetResizedFileHolder(Property.Models.FileHolder.Refresh(resizedFileHolder));
item = new(sourceDirectoryFile, relativePath, fileHolder, isValidImageFormatExtension, property, false, false);
Assert.IsNotNull(item.ImageFileHolder);
property = propertyLogic.GetProperty(item, subFileTuples, parseExceptions);
(int _, metadataCollection) = metadata.GetMetadataCollection(subFileTuples, parseExceptions, item);
imageResizeKeyValuePairs = resize.GetResizeKeyValuePairs(subFileTuples, parseExceptions, original, metadataCollection, property, item);
Property.Models.FileHolder resizedFileHolder = new(Path.Combine(resize.AngleBracketCollection[0].Replace("<>", "()"), Path.GetFileName(item.ImageFileHolder.FullName)));
item.SetResizedFileHolder(resizedFileHolder);
resize.SaveResizedSubfile(outputResolution, subFileTuples, item, original, property, imageResizeKeyValuePairs);
item.SetResizedFileHolder(Property.Models.FileHolder.Refresh(resizedFileHolder));
}
}