Skip to content

ICurrency == and != operators not returning expected result #74

Closed
@DrewBrasher

Description

@DrewBrasher

I noticed this while stepping through the code in debug mode gathering details for issue #73. There are 2 places that use the ICurrency == and != operators and I think they should be using .Equals() instead because that method is overridden but the operators cannot be overridden in an interface.

Here are the 2 places the operators are used:

model.PriceCurrency = part.Price.Currency == Currency.UnspecifiedCurrency ? _moneyService.DefaultCurrency.CurrencyIsoCode : part.Price.Currency.CurrencyIsoCode;

if (priority > int.MinValue && amount.Currency != Currency.UnspecifiedCurrency)

Here is a screenshot from debugging that shows the values:
image

and here is a screenshot after changing it to use the .Equals method:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions