public void TestCreateFilenameFromRunSettings() { var expected = @"c:\temp\PowerPosition_20171213_2350.csv"; var runSettings = new RunSettings(); runSettings.Refresh(); var powerTradesSample = TestSetupHelpers.GetPowerTradesSample(); var filenameCreator = new FilenameCreator(); var filename = filenameCreator.CreateFilename(runSettings, powerTradesSample); Assert.AreEqual(expected, filename); }
public void TestSaveFile() { var runSettings = TestSetupHelpers.GetSaveFileRunSettings(); var aggregatedTrades = TestSetupHelpers.GetPowerTrade1(); var filenameCreator = new FilenameCreator(); var filename = filenameCreator.CreateFilename(runSettings, aggregatedTrades.Date, new DateTime(2017, 12, 13, 23, 50, 55)); var fileWriter = new FileWriter(); var periodMapper = new Local23PeriodMapper(); fileWriter.WritePowerPositionCsvFile(filename, aggregatedTrades, periodMapper); var expected = File.ReadAllLines(runSettings.Path + @"PowerPosition_20171213_2350_Expected.csv"); var actual = File.ReadAllLines(filename); Assert.AreEqual(expected.Length, actual.Length); for (var i = 0; i < expected.Length; i++) { Assert.AreEqual(expected[i], actual[i]); } }