public void SmFile_LightsChart_Does_Not_Leave_Unended_Holds(string smFilePath) { // We create a copy of each .sm file since this test writes data to the files under test // and we do not want this data to conflict with other tests var smFileCopy = $"{smFilePath}.test.sm"; string backupFilePath = $"{smFileCopy}.backup"; File.Copy(smFilePath, smFileCopy, true); var smFile = new SmFile(smFileCopy); var chart = StepChartBuilder.GenerateLightsChart(smFile); smFile.WriteLightsChart(chart); var endHoldState = LightsChartHelper.VerifyLightChartHolds(smFileCopy); Assert.Equal(LightsChartHelper.LightChartHoldState.HoldingNone, endHoldState); try { if (File.Exists(smFileCopy)) { File.Delete(smFileCopy); } if (File.Exists(backupFilePath)) { File.Delete(backupFilePath); } } catch { /* intentionally left empty */ } }
public void SmFile_LightsChart_Creates_Backup_File(string smFilePath) { // We create a copy of each .sm file since this test writes data to the files under test // and we do not want this data to conflict with other tests var smFileCopy = $"{smFilePath}.test.sm"; string backupFilePath = $"{smFileCopy}.backup"; File.Copy(smFilePath, smFileCopy, true); var smFile = new SmFile(smFileCopy); var chart = StepChartBuilder.GenerateLightsChart(smFile); smFile.WriteLightsChart(chart); var backupFileExists = File.Exists(backupFilePath); Assert.True(backupFileExists, $".sm backup file was not created.\n{smFileCopy}"); try { if (File.Exists(smFileCopy)) { File.Delete(smFileCopy); } if (File.Exists(backupFilePath)) { File.Delete(backupFilePath); } } catch { /* intentionally left empty */ } }
public void SmFile_LightsChart_Throws_If_LightChart_Already_Exists(string smFilePath) { var smFileCopy = $"{smFilePath}.test.sm"; string backupFilePath = $"{smFileCopy}.backup"; File.Copy(smFilePath, smFileCopy, true); Assert.Throws <InvalidOperationException>(() => { var smFile = new SmFile(smFileCopy); var chart = StepChartBuilder.GenerateLightsChart(smFile); smFile.WriteLightsChart(chart); }); try { if (File.Exists(smFileCopy)) { File.Delete(smFileCopy); } if (File.Exists(backupFilePath)) { File.Delete(backupFilePath); } } catch { /* intentionally left empty */ } }
public void SmFile_LightsChart_Saves_Data_To_File(string smFilePath) { // We create a copy of each .sm file since this test writes data to the files under test // and we do not want this data to conflict with other tests var smFileCopy = $"{smFilePath}.test.sm"; string backupFilePath = $"{smFileCopy}.backup"; File.Copy(smFilePath, smFileCopy, true); var smFile = new SmFile(smFileCopy); bool hasLightsBeforeSave = smFile.ChartMetadata.GetSteps(PlayStyle.Lights, SongDifficulty.Easy) != null; var chart = StepChartBuilder.GenerateLightsChart(smFile); smFile.WriteLightsChart(chart); bool hasLightsAfterSave = smFile.ChartMetadata.GetSteps(PlayStyle.Lights, SongDifficulty.Easy) != null; Assert.False(hasLightsBeforeSave, $".sm file under test already has a lights chart defined.\n{smFileCopy}"); Assert.True(hasLightsAfterSave, $".sm file did not have lights chart after save.\n{smFileCopy}"); try { if (File.Exists(smFileCopy)) { File.Delete(smFileCopy); } if (File.Exists(backupFilePath)) { File.Delete(backupFilePath); } } catch { /* intentionally left empty */ } }
[InlineData(TEST_DATA_ARABIAN_NIGHTS)] //Doubles Only chart public void SmFile_GenerateLightsChart_Generates_Lights_Data_Content(string smFilePath) { var smFile = new SmFile(smFilePath); var lightsData = StepChartBuilder.GenerateLightsChart(smFile); Assert.True(!string.IsNullOrEmpty(lightsData.Content)); }
[InlineData(TEST_DATA_ARABIAN_NIGHTS, PlayStyle.Double, SongDifficulty.Challenge)] //Doubles Only chart public void SmFile_GenerateLightsChart_Maintains_Reference_Chart_Data(string smFilePath, PlayStyle referenceChartStyle, SongDifficulty referenceChartDifficulty) { var smFile = new SmFile(smFilePath); var lightsData = StepChartBuilder.GenerateLightsChart(smFile); Assert.Equal(referenceChartStyle, lightsData.ReferenceChart.PlayStyle); Assert.Equal(referenceChartDifficulty, lightsData.ReferenceChart.Difficulty); }