コード例 #1
0
        public CoinChange(CoinIdentifier coinIdentifier, CoinAction coinAction)
        {
            if (coinIdentifier == null)
            {
                throw new ArgumentNullException(nameof(coinIdentifier));
            }

            CoinIdentifier = coinIdentifier;
            CoinAction     = coinAction;
        }
コード例 #2
0
ファイル: Coin.cs プロジェクト: christiandmiles/Rosetta.Net
        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;
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }