コード例 #1
0
    public int GetCurrency(ECurrencyType currencyType)
    {
        switch (currencyType)
        {
        case ECurrencyType.Chip:
            return(_chip);

        case ECurrencyType.Core:
            return(_core);

        case ECurrencyType.Bit:
            return(_bit);

        default:
            return(-1);
        }
    }
コード例 #2
0
        public async Task GetAmountTest_inParameters(string amount,
                                                     ECurrencyType curTypeFrom, string from, string to, ECurrencyType curTypeTo, string expected, decimal expDexAmount)
        {
            //Given
            var dAmount     = Convert.ToDecimal(amount);
            var inputAmount = new CurrencyAmount(dAmount, curTypeFrom);
            var expAmount   = new CurrencyAmount(expDexAmount, curTypeTo);

            _interactor.Setup(f => f.Convert(inputAmount, curTypeTo))
            .Returns(Task.FromResult(expAmount));

            //When
            var actual = await _presenter.GetAmount(amount, from, to);

            //Then
            Assert.AreEqual(expected, actual);
            _interactor.Verify(f => f.Convert(inputAmount, curTypeTo), Times.Once);
        }
コード例 #3
0
    public int TakeCurrency(ECurrencyType currencyType, int amount)
    {
        switch (currencyType)
        {
        case ECurrencyType.Chip:
            _chip -= amount;
            return(_chip);

        case ECurrencyType.Core:
            _core -= amount;
            return(_core);

        case ECurrencyType.Bit:
            _bit -= amount;
            return(_bit);

        default:
            return(-1);
        }
    }
コード例 #4
0
        public static string ToCultureStr(this ECurrencyType type)
        {
            string result = "en-us";

            switch (type)
            {
            case ECurrencyType.USD:
                return("en-us");

            case ECurrencyType.BRT:
                return("pt-br");

            case ECurrencyType.EUR:
                return("es-ES");

            case ECurrencyType.COL:
                return("es-CO");
            }

            return(result);
        }
コード例 #5
0
 public CurrencyAmount(decimal amount, ECurrencyType currency)
 {
     Amount   = amount;
     Currency = currency;
 }
コード例 #6
0
 public void AddCurrencyValue(ECurrencyType type, int addValue)
 {
     SetCurrencyValue(type, GetCurrencyValue(type) + addValue);
 }
コード例 #7
0
 public void SetCurrency(ECurrencyType currencyType, int value)
 {
     _currencyItem[(int)currencyType].SetAmount(value);
 }
コード例 #8
0
 public void SetCurrencyValue(ECurrencyType type, int value)
 {
     SetCurrencyValue((int)type, value);
 }
コード例 #9
0
 public int GetCurrencyValue(ECurrencyType type)
 {
     return(GetCurrencyValue((int)type));
 }
コード例 #10
0
 public int GetMoneyCountOfType(ECurrencyType type)
 {
     return(_money.ContainsKey(type) ? _money[type] : 0);
 }
コード例 #11
0
 public async Task <decimal> GetRatio(ECurrencyType from, ECurrencyType to)
 {
     return(2M);
 }
コード例 #12
0
 public ChangeHistoryItem(ECurrencyType type, int quantity, int value)
 {
     Type     = type;
     Quantity = quantity;
     Value    = value;
 }