public void ReturnsValueForSingleHolding() { var handMockPortfolio = new Library.Portfolio.Portfolio(new StubStockLookupService()); handMockPortfolio.Purchase(StubStockLookupService.MSFT, 3); Assert.That(handMockPortfolio.CurrentValue(), Is.EqualTo(3 * StubStockLookupService.MSFT_VALUE)); }
public void SinglePurchaseValueUsingFactory() { StockServiceFactory.Service = new StubStockLookupService(); try { var factoryPortfolio = new Library.Portfolio.Portfolio(); factoryPortfolio.Purchase(StubStockLookupService.MSFT, 3); Assert.That(factoryPortfolio.CurrentValue(), Is.EqualTo(3 * StubStockLookupService.MSFT_VALUE)); } finally { StockServiceFactory.Reset(); } }
public void CalculatesValueForSinglePurchaseUsingRhinoMocks() { const string msft = "MSFT"; const decimal msftValue = 100m; var service = MockRepository.GenerateMock <IStockLookupService>(); service.Stub(x => x.CurrentPrice(msft)).Return(msftValue); var rhinoPortfolio = new Library.Portfolio.Portfolio(service); rhinoPortfolio.Purchase(msft, 5); Assert.That(rhinoPortfolio.CurrentValue(), Is.EqualTo(msftValue * 5)); }
public void Initialize() { portfolio = new Library.Portfolio.Portfolio(new StubStockLookupService()); }