Exemple #1
0
        public AmountEntity Subtract(AmountEntity amountEntity)
        {
            switch (amountEntity)
            {
            case GalacticCurrencyStandardEntity galacticCurrencyStandardEntity when this is GalacticCurrencyStandardEntity thisGcs:
                return(new GalacticCurrencyStandardEntity()
                {
                    Currency = CurrencyEnum.GSC,
                    Amount = thisGcs.Amount - galacticCurrencyStandardEntity.Amount
                });

            case BluCoinCurrencyEntity bluCoinCurrencyEntity when this is BluCoinCurrencyEntity thisBlc:
                return(new BluCoinCurrencyEntity()
                {
                    Currency = CurrencyEnum.BLC,
                    Tuns = thisBlc.Tuns - bluCoinCurrencyEntity.Tuns,
                    Scraposts = thisBlc.Scraposts - bluCoinCurrencyEntity.Scraposts,
                    Katts = thisBlc.Katts - bluCoinCurrencyEntity.Katts,
                    Kibels = thisBlc.Kibels - bluCoinCurrencyEntity.Kibels
                });

            default:
                throw new ArgumentOutOfRangeException(nameof(amountEntity));
            }
        }
Exemple #2
0
        public bool AreEqual(AmountEntity compareAmountEntity)
        {
            switch (this)
            {
            case GalacticCurrencyStandardEntity galacticCurrencyStandardEntity when compareAmountEntity is GalacticCurrencyStandardEntity compareGcsEntity:
                return(galacticCurrencyStandardEntity.Amount == compareGcsEntity.Amount);

            case BluCoinCurrencyEntity bluCoinCurrencyEntity when compareAmountEntity is BluCoinCurrencyEntity compareBlcEntity:
                return(bluCoinCurrencyEntity.Tuns == compareBlcEntity.Tuns &&
                       bluCoinCurrencyEntity.Scraposts == compareBlcEntity.Scraposts &&
                       bluCoinCurrencyEntity.Katts == compareBlcEntity.Katts &&
                       bluCoinCurrencyEntity.Kibels == compareBlcEntity.Kibels);

            default:
                throw new ArgumentOutOfRangeException(this.GetType().Name);
            }
        }