[Fact] | |
public void ShouldUseForexRateToCalculatePortfolioPosition() | |
{ | |
// set up a stub to return a value that should be used in the calculation | |
var forexRateRetriever = new Mock<IRetrieveForexRates>(); | |
forexRateRetriever | |
.Setup(x=> | |
x.GetCurrentRateFor( | |
It.IsAny<SourceCurrency>(), | |
It.IsAny<DestinationCurrency>()) | |
.Returns(new ForexRate(ratio:1.13m,...); | |
// the SUT can have other dependencies that could be stubbed/mocked/faked/dummied | |
// appropriately | |
var portfolioValueCalculator = CreateSUT(forexRateRetriever.Object,...); | |
var portfolioValue = portfolioValueCalculator.Calculate(); | |
// if the forexRateRetriever wasn't being used correctly, this assertion will fail | |
portfolioValue.PositionTotal.Should().Be(2000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment