public void ReadOnlyTest() { // Arrange _currencies.Add(_gold, 10f); _currencies.isReadOnly = true; // Act var canAdd = _currencies.CanAdd(_gold, 1f); var add = _currencies.Add(_gold, 2); var canRemove = _currencies.CanRemove(_gold, 1f); var remove = _currencies.Remove(_gold, 2); _currencies.Clear(); _currencies.Set(_gold, 1f); // Assert Assert.AreEqual(Errors.CollectionIsReadOnly, canAdd.error); Assert.AreEqual(Errors.CollectionIsReadOnly, add.error); Assert.AreEqual(Errors.CollectionIsReadOnly, canRemove.error); Assert.AreEqual(Errors.CollectionIsReadOnly, remove.error); Assert.IsFalse(canAdd.result); Assert.IsFalse(add.result); Assert.IsFalse(canRemove.result); Assert.IsFalse(remove.result); Assert.AreEqual(10f, _currencies.GetAmount(_gold)); }
public void BuyFromVendorNotEnoughCurrencyTest() { _customerCurrencies.Clear(); _vendorCollection.Add(_product2, 5); var canBuy = _vendor.CanBuyFromVendor(_customer, _item2, 1); Assert.AreEqual(Errors.CurrencyCollectionDoesNotContainCurrency, canBuy.error); Assert.IsFalse(canBuy.result); }
public void SellToVendorNotEnoughCurrencyTest() { _vendorCurrencies.Clear(); _vendorCollection.Add(_product1, 1); var canSell = _vendor.CanSellToVendor(_customer, _product2, 1); Assert.AreEqual(Errors.CurrencyCollectionDoesNotContainCurrency, canSell.error); Assert.IsFalse(canSell.result); }