public void CanCalculateTheCorrectRawValue(int rawValue)
        {
            Money money = new Money(rawValue);

            Assert.AreEqual(12, money.Copper);
            Assert.AreEqual(34, money.Silver);
            Assert.AreEqual(56, money.Gold);
        }
        public void CanCaculateAllValuesCorrectly(int expectedCopper, int expectedSilver, int expectedGold, int actualCopper, int actualSilver, int actualGold)
        {
            Money money = new Money(actualCopper, actualSilver, actualGold);

            Assert.AreEqual(expectedCopper, money.Copper);
            Assert.AreEqual(expectedSilver, money.Silver);
            Assert.AreEqual(expectedGold, money.Gold);
        }
 /// <summary>
 /// Initilitation of a new Transaction object.
 /// </summary>
 /// <param name="id">Id of the transaction.</param>
 /// <param name="item_id">The item id.</param>
 /// <param name="price">The price in coins.</param>
 /// <param name="quantity">The quantity of the item.</param>
 /// <param name="created">The date of creation.</param>
 /// <param name="purchased">The date of purchase.</param>
 public Transaction(long id, int item_id, int price, int quantity, DateTime created, DateTime purchased)
 {
     Id = id;
     ItemId = item_id;
     Price = new Money(price);
     Quantity = quantity;
     Created = created;
     Purchased = purchased;
 }
 /// <summary>
 /// Returns a specific amount of coins.
 /// </summary>
 /// <param name="money">The amount of coins to exchange for gems.</param>
 /// <returns>Coin object.</returns>
 public Coin GetCoin(Money money)
 {
     return DeserializeObject<Coin>("https://api.guildwars2.com/v2/commerce/exchange/coins?quantity=" + money.GetRawCoin());
 }
        public void CanReturnTheCorrectRawValue(int expectedValue, int rawValue)
        {
            Money money = new Money(rawValue);

            Assert.AreEqual(expectedValue, money.GetRawCoin());
        }
Exemple #6
0
 /// <summary>
 /// Initialization of a tpitem object.
 /// </summary>
 /// <param name="quantity">The amount of items being sold/bought.</param>
 /// <param name="unit_price">The sell offer or buy order price in coins.</param>
 public TpItem(int quantity, int unit_price)
 {
     Quantity = quantity;
     UnitPrice = new Money(unit_price);
 }