Exemplo n.º 1
0
        private InvestmentVehicleReturnsRepositoryStub CreateRepositoryStubWithSinglePortfolioMinusReturns()
        {
            var repositoryStub = new InvestmentVehicleReturnsRepositoryStub();

            var portfolio = InvestmentVehicleBuilderForTests
                            .SetupPortfolio(100, "Portfolio100")
                            .Create();

            repositoryStub.AddInvestmentVehicle(portfolio);

            return(repositoryStub);
        }
        public void ShouldWriteSinglePortfolioNetMonthRecord()
        {
            var monthYear = new MonthYear(2000, 1);

            var investmentVehicle = InvestmentVehicleFactoryForTests
                                    .SetupPortfolio(100, "Portfolio 100")
                                    .AddNetReturn(monthYear, 0.1m)
                                    .Create();

            _investmentVehicleReturnsRepositoryStub.AddInvestmentVehicle(investmentVehicle);

            var omniDataFileCreator = CreateOmniDataFileCreator();

            omniDataFileCreator.CreateFile(monthYear, _fullFilePath);

            Assert.Equal(3, _flatFileIoSpy.NumberOfLines);
            Assert.True(_flatFileIoSpy.ContainsLine("100|Portfolio|Portfolio 100|N|M|2000-1-31|0.1"));
        }
Exemplo n.º 3
0
        private InvestmentVehicleReturnsRepositoryStub CreateRepositoryStubWithSinglePortfolio(
            MonthYear monthYear)
        {
            var repositoryStub = new InvestmentVehicleReturnsRepositoryStub();

            var portfolio = InvestmentVehicleBuilderForTests
                            .SetupPortfolio(100, "Portfolio100")
                            .AddNetReturn(monthYear, 0.1m)
                            .AddNetReturn(monthYear.AddMonths(-1), 0.2m)
                            .AddNetReturn(monthYear.AddMonths(-2), 0.3m)
                            .AddNetReturn(monthYear.AddMonths(-3), 0.4m)
                            .AddNetReturn(monthYear.AddMonths(-4), 0.5m)
                            .Create();

            repositoryStub.AddInvestmentVehicle(portfolio);

            return(repositoryStub);
        }