Skip to content

Commit

Permalink
Remove unused helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
y-iihoshi committed Jan 1, 2025
1 parent 635cb83 commit 583195b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
15 changes: 0 additions & 15 deletions ThScoreFileConverter.Core/Helpers/EnumHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,4 @@ public static TEnum To<TEnum>(object value)
{
return EnumHelper<T1>.Enumerable.Cartesian(EnumHelper<T2>.Enumerable);
}

/// <summary>
/// Returns a <see cref="bool"/> telling whether a given integral value, or its name as a string, exists in a specified enumeration.
/// </summary>
/// <typeparam name="TEnum">The type of the enumeration.</typeparam>
/// <param name="value">The value or name of a constant in <typeparamref name="TEnum"/>.</param>
/// <returns>
/// <see langword="true"/> if a given integral value exists in a specified enumeration;
/// <see langword="false"/>, otherwise.
/// </returns>
public static bool IsDefined<TEnum>(TEnum value)
where TEnum : struct, Enum
{
return Enum.IsDefined(value);
}
}
9 changes: 1 addition & 8 deletions ThScoreFileConverter.Tests/Helpers/DateTimeHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ namespace ThScoreFileConverter.Tests.Helpers;
[TestClass]
public class DateTimeHelperTests
{
[TestMethod]
public void UnixEpochTest()
{
var expected = new DateTime(1970, 1, 1);
Assert.AreEqual(expected, DateTimeHelper.UnixEpoch);
}

[TestMethod]
public void FormatTest()
{
Expand All @@ -26,7 +19,7 @@ public void FormatTest()
[DataRow(1234567)]
public void GetStringTest(int unixTime)
{
var expected = DateTimeHelper.UnixEpoch.AddSeconds(unixTime).ToLocalTime()
var expected = DateTime.UnixEpoch.AddSeconds(unixTime).ToLocalTime()
.ToString(DateTimeHelper.ValidFormat, CultureInfo.CurrentCulture);
Assert.AreEqual(expected, DateTimeHelper.GetString(unixTime));
}
Expand Down
7 changes: 1 addition & 6 deletions ThScoreFileConverter/Helpers/DateTimeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ namespace ThScoreFileConverter.Helpers;
/// </summary>
public static class DateTimeHelper
{
/// <summary>
/// Gets the point in time when Unix time is equal to 0 (i.e. 1970-01-01T00:00:00Z).
/// </summary>
public static DateTime UnixEpoch { get; } = DateTime.UnixEpoch;

/// <summary>
/// Gets the date and time format string used by <see cref="GetString(double?)"/>.
/// </summary>
Expand All @@ -41,7 +36,7 @@ public static class DateTimeHelper
public static string GetString(double? unixTime)
{
return unixTime.HasValue
? UnixEpoch.AddSeconds(unixTime.Value).ToLocalTime().ToString(ValidFormat, CultureInfo.CurrentCulture)
? DateTime.UnixEpoch.AddSeconds(unixTime.Value).ToLocalTime().ToString(ValidFormat, CultureInfo.CurrentCulture)
: InvalidFormat;
}
}

0 comments on commit 583195b

Please sign in to comment.