Beispiel #1
0
        public void BuyShares_CallsBuyReservedShares()
        {
            var         mockService = new Mock <IStockMarketService>();
            StockBroker broker      = new StockBroker(mockService.Object);
            string      shareName   = "IT Högskolan";
            int         amount      = 5000;

            broker.BuyShares(shareName, amount);

            mockService.Verify(m => m.BuyReservedShares(), Times.Once);
        }
Beispiel #2
0
        public void BuyShares_CallsReserveSharesWithCorrectParameters()
        {
            var         mockService = new Mock <IStockMarketService>();
            StockBroker broker      = new StockBroker(mockService.Object);
            string      shareName   = "Ericsson";
            int         amount      = 12;

            broker.BuyShares(shareName, amount);

            mockService.Verify(m => m.ReserveShares(
                                   It.IsNotNull <string>(),
                                   It.Is <int>(x => x == amount)), Times.Once());
        }