public void ShouldReturnValidCountPositionFromPortfolio() { portfolioProcessor = Substitute.For <IFundProcessor>(); config = Substitute.For <IConfiguration>(); loggerFactory = Substitute.For <ILoggerFactory>(); config["FundsOfMandatesFile"] = "..\\..\\..\\TestData\\FundsOfMandatesData.xml"; loggerFactory.ClearReceivedCalls(); var testPortfolio = new PortfolioVM { Positions = new List <PositionVM> { new PositionVM { Code = "NL0000009165", Name = "Heineken", Value = 12345 }, new PositionVM { Code = "NL0000287100", Name = "Optimix Mix Fund", Value = 23456 }, new PositionVM { Code = "LU0035601805", Name = "DP Global Strategy L High", Value = 34567 }, new PositionVM { Code = "NL0000292332", Name = "Rabobank Core Aandelen Fonds T2", Value = 45678 }, new PositionVM { Code = "LU0042381250", Name = "Morgan Stanley Invest US Gr Fnd", Value = 56789 }, } }; portfolioProcessor.GetUpdatedPortfolio(Arg.Any <string>()).Returns(testPortfolio); PortfolioController controller = new PortfolioController(portfolioProcessor, config, loggerFactory); var result = controller.Get(); result.Should().HaveCount(c => c == 5, "GetPortfolio returns the count which matches with input count"); }
public PortfolioController(IFundProcessor processor, IConfiguration config, ILoggerFactory loggerfactory) { portfolioProcessor = processor; this.config = config; this.loggerFactory = loggerfactory; }