public void has_filtered_symbols() { var args = new ListArgs <OrderCloudIntegrationsConversionRate>() { Filters = new List <ListFilter>() { new ListFilter() { PropertyName = "Symbol", FilterValues = new List <ListFilterValue>() { new ListFilterValue() { Operator = ListFilterOperator.Equal, Term = "CAD" }, new ListFilterValue() { Operator = ListFilterOperator.Equal, Term = "USD" } } } } }; var rates = new OrderCloudIntegrationsExchangeRate() { BaseSymbol = CurrencySymbol.EUR, Rates = new List <OrderCloudIntegrationsConversionRate>() { new OrderCloudIntegrationsConversionRate() { Currency = CurrencySymbol.EUR, Icon = "", Name = "EUR", Rate = 1, Symbol = "€" }, new OrderCloudIntegrationsConversionRate() { Currency = CurrencySymbol.USD, Icon = "", Name = "USD", Rate = 1.01456, Symbol = "$" }, new OrderCloudIntegrationsConversionRate() { Currency = CurrencySymbol.CAD, Icon = "", Name = "CAD", Rate = 2.65487, Symbol = "$" }, new OrderCloudIntegrationsConversionRate() { Currency = CurrencySymbol.BGN, Icon = "", Name = "BGN", Rate = 31.357, Symbol = "лв" } } }; var filtered = _command.Filter(args, rates); Assert.IsTrue(filtered.Meta.TotalCount == 2); Assert.IsTrue(filtered.Items.Count == 2); Assert.IsTrue(filtered.Items.Any(i => i.Currency == CurrencySymbol.USD)); Assert.IsTrue(filtered.Items.Any(i => i.Currency == CurrencySymbol.CAD)); Assert.IsFalse(filtered.Items.Any(i => i.Currency == CurrencySymbol.BGN)); }
public void has_filtered_symbols() { var args = new ListArgs <OrderCloudIntegrationsConversionRate>() { Filters = new List <ListFilter>() { new ListFilter("Symbol", "CAD|USD") } }; var rates = new OrderCloudIntegrationsExchangeRate() { BaseSymbol = CurrencySymbol.EUR, Rates = GetRates() }; var filtered = _command.Filter(args, rates); Assert.IsTrue(filtered.Meta.TotalCount == 2); Assert.IsTrue(filtered.Items.Count == 2); Assert.IsTrue(filtered.Items.Any(i => i.Currency == CurrencySymbol.USD)); Assert.IsTrue(filtered.Items.Any(i => i.Currency == CurrencySymbol.CAD)); Assert.IsFalse(filtered.Items.Any(i => i.Currency == CurrencySymbol.BGN)); }