AddUserSecrets, RenameByDateTaken and BlurHash
This commit is contained in:
@ -27,25 +27,25 @@
|
||||
<DefineConstants>Linux</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="3.2.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BlurHash\BlurHash.csproj" />
|
||||
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
||||
<ProjectReference Include="..\Property\Property.csproj" />
|
||||
<ProjectReference Include="..\Metadata\Metadata.csproj" />
|
||||
<ProjectReference Include="..\Resize\Resize.csproj" />
|
||||
<ProjectReference Include="..\Property-Compare\Property-Compare.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Instance\appsettings.json">
|
||||
|
@ -46,6 +46,13 @@ public class UnitTestIsEnvironment
|
||||
_ConfigurationRoot = configurationRoot;
|
||||
}
|
||||
|
||||
private static void NonThrowTryCatch()
|
||||
{
|
||||
try
|
||||
{ throw new Exception(); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestMethodNull()
|
||||
{
|
||||
|
@ -64,6 +64,13 @@ public class UnitTestResize
|
||||
_PropertyConfiguration = propertyConfiguration;
|
||||
}
|
||||
|
||||
private static void NonThrowTryCatch()
|
||||
{
|
||||
try
|
||||
{ throw new Exception(); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestMethodNull()
|
||||
{
|
||||
@ -74,6 +81,7 @@ public class UnitTestResize
|
||||
Assert.IsFalse(_WorkingDirectory is null);
|
||||
Assert.IsFalse(_ConfigurationRoot is null);
|
||||
Assert.IsFalse(_PropertyConfiguration is null);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
private A_Property GetPropertyLogic(bool reverse, string aResultsFullGroupDirectory)
|
||||
@ -121,17 +129,8 @@ public class UnitTestResize
|
||||
[TestMethod]
|
||||
public void TestMethodResize()
|
||||
{
|
||||
// string sourceFileName = "IMG_0067.jpg";
|
||||
// string sourceDirectoryName = "Mackenzie Prom 2017";
|
||||
// string sourceFileName = "Fall 2005 (113).jpg";
|
||||
// string sourceDirectoryName = "=2005.3 Fall";
|
||||
// string sourceFileName = "DSCN0534.jpg";
|
||||
// string sourceDirectoryName = "Logan Swimming Lessons 2013";
|
||||
// string sourceFileName = "DSC_4913.jpg";
|
||||
// string sourceDirectoryName = "Disneyland 2014";
|
||||
// string sourceFileName = "Logan Michael Sept 08 (193).jpg";
|
||||
// string sourceDirectoryName = "=2008.2 Summer Logan Michael";
|
||||
string sourceFileName = "Halloween 2006 (112).jpg";
|
||||
string sourceFileName = "640794601.jpg";
|
||||
// string sourceFileName = "input.jpg";
|
||||
string sourceDirectoryName = "Halloween 2006";
|
||||
Item item;
|
||||
bool reverse = false;
|
||||
@ -145,7 +144,6 @@ public class UnitTestResize
|
||||
int length = _PropertyConfiguration.RootDirectory.Length;
|
||||
string outputResolution = _Configuration.OutputResolutions[0];
|
||||
(string cResultsFullGroupDirectory, _, _) = GetResultsFullGroupDirectories(outputResolution);
|
||||
string sourceDirectory = Path.Combine(_PropertyConfiguration.RootDirectory, sourceDirectoryName);
|
||||
(string aResultsFullGroupDirectory, string bResultsFullGroupDirectory) = GetResultsFullGroupDirectories();
|
||||
_Logger.Information(_Configuration.ModelDirectory);
|
||||
A_Property propertyLogic = GetPropertyLogic(reverse, aResultsFullGroupDirectory);
|
||||
@ -160,16 +158,18 @@ public class UnitTestResize
|
||||
bool isUniqueFileName = false;
|
||||
bool? isNotUniqueAndNeedsReview = null;
|
||||
FileHolder sourceDirectoryFileHolder = new(".json");
|
||||
string sourceDirectory = Path.GetFullPath(Path.Combine(_PropertyConfiguration.RootDirectory, sourceDirectoryName));
|
||||
FileHolder fileHolder = new(Path.Combine(sourceDirectory, sourceFileName));
|
||||
string relativePath = IPath.GetRelativePath(fileHolder.FullName, length);
|
||||
sourceDirectory = Path.Combine(aPropertySingletonDirectory, sourceDirectoryName);
|
||||
propertyLogic.SetAngleBracketCollection(aResultsFullGroupDirectory, sourceDirectory);
|
||||
string propertyLogicSourceDirectory = Path.GetFullPath(Path.Combine(aPropertySingletonDirectory, sourceDirectoryName));
|
||||
propertyLogic.SetAngleBracketCollection(aResultsFullGroupDirectory, propertyLogicSourceDirectory);
|
||||
resize.SetAngleBracketCollection(_Configuration.PropertyConfiguration, cResultsFullGroupDirectory, sourceDirectory);
|
||||
item = new(sourceDirectoryFileHolder, relativePath, fileHolder, isNotUniqueAndNeedsReview, isUniqueFileName, isValidImageFormatExtension, property, false, false, false);
|
||||
Assert.IsNotNull(item.ImageFileHolder);
|
||||
if (item.Property is null)
|
||||
{
|
||||
property = propertyLogic.GetProperty(item, subFileTuples, parseExceptions);
|
||||
Shared.Models.Methods.IBlurHasher? blurHasher = new BlurHash.Models.BlurHasher();
|
||||
property = propertyLogic.GetProperty(blurHasher, item, subFileTuples, parseExceptions);
|
||||
item.Update(property);
|
||||
}
|
||||
if (property is null || item.Property is null)
|
||||
@ -181,6 +181,7 @@ public class UnitTestResize
|
||||
outputResolutionToResize = resize.GetResizeKeyValuePairs(_Configuration.PropertyConfiguration, cResultsFullGroupDirectory, subFileTuples, parseExceptions, metadataCollection, item.Property, mappingFromItem);
|
||||
Assert.IsNotNull(mappingFromItem.ResizedFileHolder);
|
||||
resize.SaveResizedSubfile(_Configuration.PropertyConfiguration, outputResolution, cResultsFullGroupDirectory, subFileTuples, item, item.Property, mappingFromItem, outputResolutionToResize);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user