public void ShouldNotWriteBenchmarkData() { var monthYear = new MonthYear(2000, 1); var iv100 = InvestmentVehicleBuilderForTests .SetupPortfolio(100, "Portfolio 100") .AddNetReturn(monthYear, 0.1m) .Create(); _investmentVehicleReturnsRepositoryStub.AddInvestmentVehicle(iv100); var iv101 = InvestmentVehicleBuilderForTests .SetupBenchmark(1000, "Benchmark 101") .AddNetReturn(monthYear, 0.1m) .Create(); _investmentVehicleReturnsRepositoryStub.AddInvestmentVehicle(iv101); 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")); }
private InvestmentVehicleReturnsRepositoryStub CreateRepositoryStubWithSinglePortfolioMinusReturns() { var repositoryStub = new InvestmentVehicleReturnsRepositoryStub(); var portfolio = InvestmentVehicleBuilderForTests .SetupPortfolio(100, "Portfolio100") .Create(); repositoryStub.AddInvestmentVehicle(portfolio); return(repositoryStub); }
private InvestmentVehicle SetupFourMonthsOfData( MonthYear monthYear) { var investmentVehicle = InvestmentVehicleBuilderForTests .SetupPortfolio(100, "Portfolio 100") .AddNetReturn(monthYear, 0.1m) .AddNetReturn(monthYear.AddMonths(-1), 0.2m) .AddNetReturn(monthYear.AddMonths(-2), 0.3m) .AddNetReturn(monthYear.AddMonths(-3), 0.4m) .AddGrossReturn(monthYear, 0.5m) .AddGrossReturn(monthYear.AddMonths(-1), 0.6m) .AddGrossReturn(monthYear.AddMonths(-2), 0.7m) .AddGrossReturn(monthYear.AddMonths(-3), 0.8m) .Create(); return(investmentVehicle); }
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); }
public void ShouldWriteMonthForYearToCurrentMonth() { var monthYear = new MonthYear(2000, 3); var investmentVehicle = InvestmentVehicleBuilderForTests .SetupPortfolio(100, "Portfolio 100") .AddNetReturn(monthYear, 0.1m) .AddNetReturn(monthYear.AddMonths(-1), 0.2m) .AddNetReturn(monthYear.AddMonths(-2), 0.3m) .AddNetReturn(monthYear.AddMonths(-3), 0.4m) .Create(); _investmentVehicleReturnsRepositoryStub.AddInvestmentVehicle(investmentVehicle); var omniDataFileCreator = CreateOmniDataFileCreator(); omniDataFileCreator.CreateFile(monthYear, _fullFilePath); Assert.Equal(6, _flatFileIoSpy.NumberOfLines); Assert.True(_flatFileIoSpy.ContainsLine("100|Portfolio|Portfolio 100|N|M|2000-3-31|0.1")); Assert.True(_flatFileIoSpy.ContainsLine("100|Portfolio|Portfolio 100|N|M|2000-2-29|0.2")); Assert.True(_flatFileIoSpy.ContainsLine("100|Portfolio|Portfolio 100|N|M|2000-1-31|0.3")); }