Skip to content

Commit

Permalink
adds tests and sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
andreteixeiraorakolo committed Apr 18, 2019
1 parent 4a74e9e commit 3a00e91
Show file tree
Hide file tree
Showing 5 changed files with 274 additions and 24 deletions.
10 changes: 5 additions & 5 deletions src/TeixeiraSoftware.Finance.Currency.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>TeixeiraSoftware.Finance.Currency</AssemblyName>
<Title>TeixeiraSoftware.Finance.Currency</Title>
<PackageVersion>4.0.3</PackageVersion>
<PackageVersion>4.1.0</PackageVersion>
<AssemblyCompany>Teixeira Software</AssemblyCompany>
<AssemblyDescription>A simple cross platform currency class that follows the ISO 4217 standard.</AssemblyDescription>
<RootNamespace>TeixeiraSoftware</RootNamespace>
Expand All @@ -17,13 +17,13 @@
<RepositoryUrl>https://github.com/andremarcondesteixeira/TeixeiraSoftware.Finance.Currency</RepositoryUrl>
<PackageTags>currency;money;finance;netstandard</PackageTags>
<NeutralLanguage>en</NeutralLanguage>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<FileVersion>4.0.3.0</FileVersion>
<Version>4.0.3</Version>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<FileVersion>4.1.0.0</FileVersion>
<Version>4.1.0</Version>
<PackageProjectUrl>https://andremarcondesteixeira.github.io/TeixeiraSoftware.Finance.Currency/</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIconUrl>https://github.com/andremarcondesteixeira/assets/raw/master/logo_small.png</PackageIconUrl>
<PackageReleaseNotes>First release.</PackageReleaseNotes>
<PackageReleaseNotes>Added currency signs and sorting</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<Optimize>True</Optimize>
Expand Down
10 changes: 8 additions & 2 deletions src/TeixeiraSoftware/Finance/IComparableImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ public partial struct Currency : ICurrency, IComparable, IComparable<ICurrency>
/// </returns>
public int CompareTo(object other)
{
throw new NotImplementedException();
if (other is ICurrency) {
return this.Symbol.CompareTo(((ICurrency) other).Symbol);
}

throw new ArgumentException(
$"{other.ToString()} is not an instance of TeixeiraSoftware.Finance.ICurrency"
);
}

/// <summary>Compares two currencies for sorting purposes</summary>
Expand All @@ -25,7 +31,7 @@ public int CompareTo(object other)
/// </returns>
public int CompareTo(ICurrency other)
{
throw new NotImplementedException();
return this.Symbol.CompareTo(other.Symbol);
}
}
}
2 changes: 1 addition & 1 deletion src/TeixeiraSoftware/Finance/IEquatableImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public override bool Equals(object currency)
}

throw new ArgumentException(
$"{currency.ToString()} is not an instance of TeixeiraSoftware.Finance.Currency"
$"{currency.ToString()} is not an instance of TeixeiraSoftware.Finance.ICurrency"
);
}

Expand Down
Loading

0 comments on commit 3a00e91

Please sign in to comment.