Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed May 27, 2023
1 parent 45a060f commit 7e4a189
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions src/Verify/Verifier/InnerVerifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,8 @@ public InnerVerifier(
var namer = settings.Namer;

directory = ResolveDirectory(sourceFile, settings, pathInfo);
counter = Counter.Start(
#if NET6_0_OR_GREATER
settings.namedDates,
settings.namedTimes,
#endif
settings.namedDateTimes,
settings.namedGuids,
settings.namedDateTimeOffsets
);

counter = StartCounter(settings);

IoHelpers.CreateDirectory(directory);

Expand All @@ -82,31 +75,39 @@ public InnerVerifier(string sourceFile, VerifySettings settings)
this.settings = settings;
directory = ResolveDirectory(sourceFile, settings, new());

counter = Counter.Start(
#if NET6_0_OR_GREATER
settings.namedDates,
settings.namedTimes,
#endif
settings.namedDateTimes,
settings.namedGuids,
settings.namedDateTimeOffsets
);
counter = StartCounter(settings);

IoHelpers.CreateDirectory(directory);

ValidatePrefix(settings, directory);

verifiedFiles = new List<string> { Path.Combine(directory, $"{Path.GetFileNameWithoutExtension(sourceFile)}.verified.{FileExtensions.GetExtension(sourceFile)}") };
var withoutExtension = Path.GetFileNameWithoutExtension(sourceFile);
verifiedFiles = new List<string>
{
Path.Combine(directory, $"{withoutExtension}.verified.{FileExtensions.GetExtension(sourceFile)}")
};

getFileNames = target => new(
target.Extension,
sourceFile,
Path.Combine(directory, $"{Path.GetFileNameWithoutExtension(sourceFile)}.verified.{target.Extension}")
);
getFileNames = target =>
new(
target.Extension,
sourceFile,
Path.Combine(directory, $"{withoutExtension}.verified.{target.Extension}")
);

getIndexedFileNames = (_, _) => throw new NotImplementedException();
}

static Counter StartCounter(VerifySettings settings) =>
Counter.Start(
#if NET6_0_OR_GREATER
settings.namedDates,
settings.namedTimes,
#endif
settings.namedDateTimes,
settings.namedGuids,
settings.namedDateTimeOffsets
);

void InitForDirectoryConvention(Namer namer, string typeAndMethod, string parameters)
{
var verifiedPrefix = PrefixForDirectoryConvention(namer, typeAndMethod, parameters);
Expand Down

0 comments on commit 7e4a189

Please sign in to comment.