Skip to content

Commit

Permalink
finish application of amendment 161 by making BYR obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
dgg committed Jul 18, 2017
1 parent 46f3a3c commit 9c56e29
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion NMoneys.nuspec
Expand Up @@ -3,7 +3,7 @@
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>NMoneys</id>
<title>NMoneys</title>
<version>5.1.0.0</version>
<version>5.1.1.0</version>
<authors>Daniel González García</authors>
<licenseUrl>http://www.opensource.org/licenses/bsd-license.php</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
Expand Down
5 changes: 0 additions & 5 deletions src/NMoneys.Tests/CurrencyTester.cs
Expand Up @@ -155,11 +155,6 @@ public void ObsoleteCurrencies_AreConsistent()

// all currency codes are marked as obsolete
Assert.That(obsoleteCodes, Has.All.Matches<CurrencyIsoCode>(Enumeration.HasAttribute<CurrencyIsoCode, ObsoleteAttribute>));

// there no more currency codes marked as obsolete than obsolete currencies
Assert.That(obsoleteCodes, Is.EquivalentTo(
Enumeration.GetValues<CurrencyIsoCode>()
.Where(Enumeration.HasAttribute<CurrencyIsoCode, ObsoleteAttribute>)));
}

#pragma warning restore 169
Expand Down
1 change: 1 addition & 0 deletions src/NMoneys/Currencies.xml
Expand Up @@ -289,6 +289,7 @@
<groupSizes>3</groupSizes>
<positivePattern>3</positivePattern>
<negativePattern>8</negativePattern>
<obsolete>true</obsolete>
</currency>
<currency code="BZD">
<englishName>Belize Dollar</englishName>
Expand Down
2 changes: 1 addition & 1 deletion src/NMoneys/CurrencyIsoCode.cs
Expand Up @@ -142,7 +142,7 @@ public enum CurrencyIsoCode : short
/// <summary>
/// Belarussian Ruble
/// </summary>
[EnumMember, CanonicalCulture("be-BY")]
[EnumMember, CanonicalCulture("be-BY"), Obsolete("deprecated in favor of BYN")]
BYR = 974,
/// <summary>
/// Belize Dollar
Expand Down
18 changes: 8 additions & 10 deletions src/NMoneys/ObsoleteCurrencies.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using NMoneys.Support;

namespace NMoneys
Expand All @@ -13,15 +14,12 @@ internal static class ObsoleteCurrencies
private static readonly HashSet<CurrencyIsoCode> _set;
static ObsoleteCurrencies()
{
#pragma warning disable 612,618
_set = new HashSet<CurrencyIsoCode>(FastEnumComparer<CurrencyIsoCode>.Instance)
{
CurrencyIsoCode.EEK,
CurrencyIsoCode.ZMK,
CurrencyIsoCode.LVL,
CurrencyIsoCode.LTL,
};
#pragma warning restore 612,618
var obsoleteCodes = Enumeration.GetValues<CurrencyIsoCode>()
.Where(Enumeration.HasAttribute<CurrencyIsoCode, ObsoleteAttribute>);

_set = new HashSet<CurrencyIsoCode>(
obsoleteCodes,
FastEnumComparer<CurrencyIsoCode>.Instance);
}

[Pure]
Expand All @@ -37,6 +35,6 @@ public static bool IsObsolete(Currency currency)
}

[Pure]
public static uint Count => Convert.ToUInt32(_set.Count);
public static ushort Count => Convert.ToUInt16(_set.Count);
}
}
4 changes: 2 additions & 2 deletions src/NMoneys/Properties/NMoneys_AssemblyInfo.cs
Expand Up @@ -26,5 +26,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.1.0.0")]
[assembly: AssemblyFileVersion("5.1.0.0")]
[assembly: AssemblyVersion("5.1.1.0")]
[assembly: AssemblyFileVersion("5.1.1.0")]

0 comments on commit 9c56e29

Please sign in to comment.