public CoinChange(CoinIdentifier coinIdentifier, CoinAction coinAction) { if (coinIdentifier == null) { throw new ArgumentNullException(nameof(coinIdentifier)); } CoinIdentifier = coinIdentifier; CoinAction = coinAction; }
internal Coin(CoinIdentifier coinIdentifier, Amount amount) { if (coinIdentifier == null) { throw new ArgumentNullException(nameof(coinIdentifier)); } if (amount == null) { throw new ArgumentNullException(nameof(amount)); } CoinIdentifier = coinIdentifier; Amount = amount; }
internal static CoinChange DeserializeCoinChange(JsonElement element) { CoinIdentifier coinIdentifier = default; CoinAction coinAction = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("coin_identifier")) { coinIdentifier = CoinIdentifier.DeserializeCoinIdentifier(property.Value); continue; } if (property.NameEquals("coin_action")) { coinAction = new CoinAction(property.Value.GetString()); continue; } } return(new CoinChange(coinIdentifier, coinAction)); }
internal static Coin DeserializeCoin(JsonElement element) { CoinIdentifier coinIdentifier = default; Amount amount = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("coin_identifier")) { coinIdentifier = CoinIdentifier.DeserializeCoinIdentifier(property.Value); continue; } if (property.NameEquals("amount")) { amount = Amount.DeserializeAmount(property.Value); continue; } } return(new Coin(coinIdentifier, amount)); }