mwpowellhtx / BumpAssemblyVersions

A flexible way of Bumping Assembly Versions with a rich set of instructions how to do so.
GNU General Public License v3.0
4 stars 0 forks source link

Rethink Version Provider Name based dictionary keys #5

Closed mwpowellhtx closed 4 years ago

mwpowellhtx commented 4 years ago

Rethink Name based dictionary keyed Version Providers. May instead consider whether positional keys, literally, Major, Minor, Patch, Build, etc. In fact, may wonder whether dictionary is necessary after all. Would also need to rethink what we were doing with the dynamic Registry, usage such as Registry.Unknown and Registry.NoOp, etc.

mwpowellhtx commented 4 years ago

On the other hand, maintaining the Dictionary, EO approach, would need to reconsider the DeltaDays provider naming convention. It should be fairly straightforward to ensure a unique name on that one, perhaps involving an actual Days delta.

mwpowellhtx commented 4 years ago

This in the queue will probably solve the issue.

/// <summary>
/// Gets the Actual Days involved during the Change attempt.
/// </summary>
internal int ActualDaysValue => (ProtectedTimestamp - BaseTimestamp).Days + 1;

/// <summary>
/// Gets the Provider Name.
/// </summary>
/// <see cref="ActualDaysValue"/>
/// <inheritdoc />
public sealed override string Name => $"{ActualDaysValue} Days Since {BaseTimestamp:d}";

/// <summary>
/// Performs the Provider Strategy.
/// </summary>
/// <param name="current"></param>
/// <param name="result"></param>
/// <returns></returns>
/// <see cref="ActualDaysValue"/>
/// <inheritdoc />
public sealed override bool TryChange(string current, out string result) => Changed = (result = $"{ActualDaysValue % MaxValue}") != current;
mwpowellhtx commented 4 years ago

We think this has been resolved. Put tests in to verify that the keys and therefore the IVersionProvider.Name instances are all unique.