public void ErrorIfNoAllocationsToStocksOrBonds() { const int amount = 42; var deposit = new DepositRequest { Amount = amount, Investor = new Investor { } }; var mockAllocator = new Mock <IInvestementAllocator>(); mockAllocator.Setup(x => x.Calculate(amount, deposit.Investor)) .Returns(new InvestementAllocation { AmountToBonds = 0, AmountToStocks = 0 }); Assert.Throws <Exception>(() => CalculatePortfolioAllocation.Run(deposit, out var stockPurchase, out var bondPurchase, mockAllocator.Object, new Mock <ILogger>().Object)); }
public void WriteToPurchaseStockAndBondsQueue() { const int amount = 42; var deposit = new DepositRequest { Amount = amount, Investor = new Investor { } }; var mockAllocator = new Mock <IInvestementAllocator>(); mockAllocator.Setup(x => x.Calculate(amount, deposit.Investor)) .Returns(new InvestementAllocation { AmountToBonds = 2, AmountToStocks = 1 }); CalculatePortfolioAllocation.Run(deposit, out var stockPurchase, out var bondPurchase, mockAllocator.Object, new Mock <ILogger>().Object); Assert.Equal(1, stockPurchase.Amount); Assert.Equal(2, bondPurchase.Amount); }