public void SellStock_WithInvalidSymbol_ThrowsInvalidSymbolException() { string symbol = "T"; Account seller = CreateAccount(symbol, 10); Assert.ThrowsAsync <InsufficientSharesException>(() => sellStockService.SellStock(seller, symbol, 20)); }
public void SellStock_WithInsufficientShares_ThrowsInsufficientSharesException() { string expectedSymbol = "T"; int expectedAccountShares = 0; int expectedRequiredShares = 10; Account seller = CreateAccount(expectedSymbol, expectedAccountShares); InsufficientSharesException exception = Assert.ThrowsAsync <InsufficientSharesException>( () => _sellStockService.SellStock(seller, expectedSymbol, expectedRequiredShares)); string actualSymbol = exception.Symbol; double actualAccountBalance = exception.AccountShares; double actualRequiredBalance = exception.RequiredShares; Assert.AreEqual(expectedSymbol, actualSymbol); Assert.AreEqual(expectedAccountShares, actualAccountBalance); Assert.AreEqual(expectedRequiredShares, actualRequiredBalance); }