From ff6dd12352b53557ecd93652e15fcf06424152d9 Mon Sep 17 00:00:00 2001 From: Will Baldoumas <45316999+wbaldoumas@users.noreply.github.com> Date: Sun, 8 Dec 2024 15:55:59 -0800 Subject: [PATCH] Cleanup (#210) --- src/BaroquenMelody.App/App.xaml.cs | 21 ++++++------- .../Choices/ChordChoice.cs | 3 +- .../Choices/DuetChordChoiceRepository.cs | 14 ++++----- .../Choices/IChordChoiceRepository.cs | 7 ----- .../Choices/NoteChoiceGenerator.cs | 4 +-- .../Choices/QuartetChordChoiceRepository.cs | 15 ++-------- .../Choices/SoloChordChoiceRepository.cs | 2 -- .../Choices/TrioChordChoiceRepository.cs | 14 ++------- .../Composers/Composer.cs | 5 ++-- .../Engine/Utilities/VelocityCalculator.cs | 3 +- .../MusicTheory/NoteOnsetCalculator.cs | 6 ++-- .../Phrasing/CompositionPhraser.cs | 30 +++++++++---------- .../Phrasing/ThemeSplitter.cs | 4 +-- .../Collections/FixedSizeListTests.cs | 8 ++--- .../Choices/DuetChordChoiceRepositoryTests.cs | 25 ---------------- .../QuartetChordChoiceRepositoryTests.cs | 27 ----------------- .../Choices/SoloChordChoiceRepositoryTests.cs | 24 --------------- .../Choices/TrioChordChoiceRepositoryTests.cs | 26 ---------------- 18 files changed, 52 insertions(+), 186 deletions(-) diff --git a/src/BaroquenMelody.App/App.xaml.cs b/src/BaroquenMelody.App/App.xaml.cs index 7719bf8e..5aa4cf76 100644 --- a/src/BaroquenMelody.App/App.xaml.cs +++ b/src/BaroquenMelody.App/App.xaml.cs @@ -7,6 +7,10 @@ namespace BaroquenMelody.App; /// public partial class App : Application { + private const string Title = "Baroquen Melody"; + + private const string IsDarkModeKey = "IsDarkMode"; + private readonly IThemeProvider _themeProvider; public App(IThemeProvider themeProvider) @@ -15,25 +19,18 @@ public App(IThemeProvider themeProvider) _themeProvider = themeProvider; - _themeProvider.IsDarkMode = Preferences.Default.Get("IsDarkMode", defaultValue: true); - - MainPage = new MainPage - { - Title = "Baroquen Melody" - }; + _themeProvider.IsDarkMode = Preferences.Default.Get(IsDarkModeKey, defaultValue: true); } protected override Window CreateWindow(IActivationState? activationState) { - var window = base.CreateWindow(activationState) ?? throw new InvalidOperationException("Window is null"); - - window.Title = "Baroquen Melody"; - - window.Destroying += (_, _) => + var window = new Window(new MainPage { Title = Title }) { - Preferences.Default.Set("IsDarkMode", _themeProvider.IsDarkMode); + Title = Title }; + window.Destroying += (_, _) => { Preferences.Default.Set(IsDarkModeKey, _themeProvider.IsDarkMode); }; + return window; } } diff --git a/src/BaroquenMelody.Library/Choices/ChordChoice.cs b/src/BaroquenMelody.Library/Choices/ChordChoice.cs index 86ebb694..44dde363 100644 --- a/src/BaroquenMelody.Library/Choices/ChordChoice.cs +++ b/src/BaroquenMelody.Library/Choices/ChordChoice.cs @@ -26,7 +26,8 @@ public override int GetHashCode() { return NoteChoices.Aggregate( HashCodeGeneration.Seed, - (current, noteChoice) => current * HashCodeGeneration.Multiplier ^ noteChoice.GetHashCode()); + (current, noteChoice) => current * HashCodeGeneration.Multiplier ^ noteChoice.GetHashCode() + ); } } } diff --git a/src/BaroquenMelody.Library/Choices/DuetChordChoiceRepository.cs b/src/BaroquenMelody.Library/Choices/DuetChordChoiceRepository.cs index 2cae7ea9..0568a81d 100644 --- a/src/BaroquenMelody.Library/Choices/DuetChordChoiceRepository.cs +++ b/src/BaroquenMelody.Library/Choices/DuetChordChoiceRepository.cs @@ -12,18 +12,18 @@ internal sealed class DuetChordChoiceRepository : IChordChoiceRepository private readonly LazyCartesianProduct _noteChoices; - public DuetChordChoiceRepository(CompositionConfiguration compositionConfiguration, INoteChoiceGenerator noteChoiceGenerator) + public DuetChordChoiceRepository(CompositionConfiguration configuration, INoteChoiceGenerator noteChoiceGenerator) { - if (compositionConfiguration.Instruments.Count != NumberOfInstruments) + if (configuration.Instruments.Count != NumberOfInstruments) { throw new ArgumentException( "The composition configuration must contain exactly two instrument configurations.", - nameof(compositionConfiguration) + nameof(configuration) ); } - var noteChoicesForInstruments = compositionConfiguration.Instruments - .OrderBy(static instrument => instrument) + var noteChoicesForInstruments = configuration.Instruments + .Order() .Select(noteChoiceGenerator.GenerateNoteChoices) .ToList(); @@ -36,8 +36,4 @@ [.. noteChoicesForInstruments[1]] public BigInteger Count => _noteChoices.Size; public ChordChoice GetChordChoice(BigInteger id) => _noteChoices[id].ToChordChoice(); - - public BigInteger GetChordChoiceId(ChordChoice chordChoice) => _noteChoices.IndexOf( - (chordChoice.NoteChoices[0], chordChoice.NoteChoices[1]) - ); } diff --git a/src/BaroquenMelody.Library/Choices/IChordChoiceRepository.cs b/src/BaroquenMelody.Library/Choices/IChordChoiceRepository.cs index ad437bf5..96264bbe 100644 --- a/src/BaroquenMelody.Library/Choices/IChordChoiceRepository.cs +++ b/src/BaroquenMelody.Library/Choices/IChordChoiceRepository.cs @@ -18,11 +18,4 @@ internal interface IChordChoiceRepository /// The ID of the to get. /// The for the given ID. public ChordChoice GetChordChoice(BigInteger id); - - /// - /// Get the ID of the given . - /// - /// The to get the ID of. - /// The ID of the given . - BigInteger GetChordChoiceId(ChordChoice chordChoice); } diff --git a/src/BaroquenMelody.Library/Choices/NoteChoiceGenerator.cs b/src/BaroquenMelody.Library/Choices/NoteChoiceGenerator.cs index 50e04168..7c6e773c 100644 --- a/src/BaroquenMelody.Library/Choices/NoteChoiceGenerator.cs +++ b/src/BaroquenMelody.Library/Choices/NoteChoiceGenerator.cs @@ -7,12 +7,12 @@ namespace BaroquenMelody.Library.Choices; /// internal sealed class NoteChoiceGenerator(byte minScaleStepChange = 1, byte maxScaleStepChange = CompositionConfiguration.MaxScaleStepChange) : INoteChoiceGenerator { - private readonly NoteMotion[] noteMotions = [NoteMotion.Ascending, NoteMotion.Descending]; + private readonly NoteMotion[] _noteMotions = [NoteMotion.Ascending, NoteMotion.Descending]; public ISet GenerateNoteChoices(Instrument instrument) => Enumerable .Range(minScaleStepChange, maxScaleStepChange - minScaleStepChange + 1) .Select(static scaleStepChange => (byte)scaleStepChange) - .SelectMany(scaleStepChange => noteMotions.Select(noteMotion => new NoteChoice(instrument, noteMotion, scaleStepChange))) + .SelectMany(scaleStepChange => _noteMotions.Select(noteMotion => new NoteChoice(instrument, noteMotion, scaleStepChange))) .Append(new NoteChoice(instrument, NoteMotion.Oblique, 0)) .ToFrozenSet(); } diff --git a/src/BaroquenMelody.Library/Choices/QuartetChordChoiceRepository.cs b/src/BaroquenMelody.Library/Choices/QuartetChordChoiceRepository.cs index e44c64ef..99e36f36 100644 --- a/src/BaroquenMelody.Library/Choices/QuartetChordChoiceRepository.cs +++ b/src/BaroquenMelody.Library/Choices/QuartetChordChoiceRepository.cs @@ -24,9 +24,9 @@ public QuartetChordChoiceRepository( ); } - var noteChoicesForInstruments = configuration.InstrumentConfigurations - .OrderBy(static instrumentConfiguration => instrumentConfiguration.Instrument) - .Select(instrumentConfiguration => noteChoiceGenerator.GenerateNoteChoices(instrumentConfiguration.Instrument)) + var noteChoicesForInstruments = configuration.Instruments + .Order() + .Select(noteChoiceGenerator.GenerateNoteChoices) .ToList(); _noteChoices = new LazyCartesianProduct( @@ -40,13 +40,4 @@ [.. noteChoicesForInstruments[3]] public BigInteger Count => _noteChoices.Size; public ChordChoice GetChordChoice(BigInteger id) => _noteChoices[id].ToChordChoice(); - - public BigInteger GetChordChoiceId(ChordChoice chordChoice) => _noteChoices.IndexOf( - ( - chordChoice.NoteChoices[0], - chordChoice.NoteChoices[1], - chordChoice.NoteChoices[2], - chordChoice.NoteChoices[3] - ) - ); } diff --git a/src/BaroquenMelody.Library/Choices/SoloChordChoiceRepository.cs b/src/BaroquenMelody.Library/Choices/SoloChordChoiceRepository.cs index e396c330..50b7d5ea 100644 --- a/src/BaroquenMelody.Library/Choices/SoloChordChoiceRepository.cs +++ b/src/BaroquenMelody.Library/Choices/SoloChordChoiceRepository.cs @@ -27,6 +27,4 @@ public SoloChordChoiceRepository(CompositionConfiguration compositionConfigurati public BigInteger Count => _noteChoices.Count; public ChordChoice GetChordChoice(BigInteger id) => _noteChoices[(int)id].ToChordChoice(); - - public BigInteger GetChordChoiceId(ChordChoice chordChoice) => _noteChoices.IndexOf(chordChoice.NoteChoices[0]); } diff --git a/src/BaroquenMelody.Library/Choices/TrioChordChoiceRepository.cs b/src/BaroquenMelody.Library/Choices/TrioChordChoiceRepository.cs index 823ef9b3..23333ea1 100644 --- a/src/BaroquenMelody.Library/Choices/TrioChordChoiceRepository.cs +++ b/src/BaroquenMelody.Library/Choices/TrioChordChoiceRepository.cs @@ -22,9 +22,9 @@ public TrioChordChoiceRepository(CompositionConfiguration configuration, INoteCh ); } - var noteChoicesForInstruments = configuration.InstrumentConfigurations - .OrderBy(static instrumentConfiguration => instrumentConfiguration.Instrument) - .Select(instrumentConfiguration => noteChoiceGenerator.GenerateNoteChoices(instrumentConfiguration.Instrument)) + var noteChoicesForInstruments = configuration.Instruments + .Order() + .Select(noteChoiceGenerator.GenerateNoteChoices) .ToList(); _noteChoices = new LazyCartesianProduct( @@ -37,12 +37,4 @@ [.. noteChoicesForInstruments[2]] public BigInteger Count => _noteChoices.Size; public ChordChoice GetChordChoice(BigInteger id) => _noteChoices[id].ToChordChoice(); - - public BigInteger GetChordChoiceId(ChordChoice chordChoice) => _noteChoices.IndexOf( - ( - chordChoice.NoteChoices[0], - chordChoice.NoteChoices[1], - chordChoice.NoteChoices[2] - ) - ); } diff --git a/src/BaroquenMelody.Library/Composers/Composer.cs b/src/BaroquenMelody.Library/Composers/Composer.cs index c27c767e..d73658d6 100644 --- a/src/BaroquenMelody.Library/Composers/Composer.cs +++ b/src/BaroquenMelody.Library/Composers/Composer.cs @@ -108,16 +108,15 @@ private Composition ApplyPhrasing(Composition initialComposition, BaroquenTheme compositionPhraser.AddTheme(theme); - var currentMeasureIndex = 0; var phrasedMeasures = new List(); - foreach (var measure in initialComposition.Measures) + foreach (var (currentMeasureIndex, measure) in initialComposition.Measures.Index()) { cancellationToken.ThrowIfCancellationRequested(); phrasedMeasures.Add(measure); - if (currentMeasureIndex++ % compositionConfiguration.PhrasingConfiguration.MinPhraseLength == 0) + if (currentMeasureIndex % compositionConfiguration.PhrasingConfiguration.MinPhraseLength == 0) { compositionPhraser.AttemptPhraseRepetition(phrasedMeasures); } diff --git a/src/BaroquenMelody.Library/Dynamics/Engine/Utilities/VelocityCalculator.cs b/src/BaroquenMelody.Library/Dynamics/Engine/Utilities/VelocityCalculator.cs index 7a3619af..f35f41e6 100644 --- a/src/BaroquenMelody.Library/Dynamics/Engine/Utilities/VelocityCalculator.cs +++ b/src/BaroquenMelody.Library/Dynamics/Engine/Utilities/VelocityCalculator.cs @@ -20,7 +20,8 @@ public IEnumerable GetPrecedingVelocities(FixedSizeList pr { Validate(precedingBeats, instrument); - return precedingBeats.TakeLast(count) + return precedingBeats + .TakeLast(count) .Reverse() .Select(beat => { diff --git a/src/BaroquenMelody.Library/MusicTheory/NoteOnsetCalculator.cs b/src/BaroquenMelody.Library/MusicTheory/NoteOnsetCalculator.cs index e07e681f..6bba37ec 100644 --- a/src/BaroquenMelody.Library/MusicTheory/NoteOnsetCalculator.cs +++ b/src/BaroquenMelody.Library/MusicTheory/NoteOnsetCalculator.cs @@ -14,19 +14,19 @@ internal sealed class NoteOnsetCalculator( CompositionConfiguration compositionConfiguration ) : INoteOnsetCalculator { - private static readonly MusicalTimeSpan _resolution = MusicalTimeSpan.ThirtySecond; + private static readonly MusicalTimeSpan Resolution = MusicalTimeSpan.ThirtySecond; public BitArray CalculateNoteOnsets(OrnamentationType ornamentationType) { var bitArray = InitializeNoteOnsetBitArray(compositionConfiguration.Meter); var primaryNoteDuration = musicalTimeSpanCalculator.CalculatePrimaryNoteTimeSpan(ornamentationType, compositionConfiguration.Meter); var ornamentationCount = ornamentationType.OrnamentationCount(); - var noteOnsetCursor = primaryNoteDuration.DivideBy(_resolution); + var noteOnsetCursor = primaryNoteDuration.DivideBy(Resolution); for (var ornamentationStep = 0; ornamentationStep < ornamentationCount; ornamentationStep++) { var ornamentationDuration = musicalTimeSpanCalculator.CalculateOrnamentationTimeSpan(ornamentationType, compositionConfiguration.Meter, ornamentationStep); - var cursorProgressionValue = ornamentationDuration.DivideBy(_resolution); + var cursorProgressionValue = ornamentationDuration.DivideBy(Resolution); bitArray[noteOnsetCursor] = true; diff --git a/src/BaroquenMelody.Library/Phrasing/CompositionPhraser.cs b/src/BaroquenMelody.Library/Phrasing/CompositionPhraser.cs index dd108e1b..629451c2 100644 --- a/src/BaroquenMelody.Library/Phrasing/CompositionPhraser.cs +++ b/src/BaroquenMelody.Library/Phrasing/CompositionPhraser.cs @@ -19,13 +19,13 @@ internal sealed class CompositionPhraser( CompositionConfiguration compositionConfiguration ) : ICompositionPhraser { - private readonly List phrasesToRepeat = []; + private readonly List _phrasesToRepeat = []; - private readonly Queue coolOffPhrases = new(); + private readonly Queue _coolOffPhrases = new(); - private List themePhrasesToRepeat = []; + private List _themePhrasesToRepeat = []; - private RepeatedPhrase? themeCoolOffPhrase; + private RepeatedPhrase? _themeCoolOffPhrase; public void AttemptPhraseRepetition(List measures) { @@ -39,9 +39,9 @@ public void AttemptPhraseRepetition(List measures) public void AddTheme(BaroquenTheme theme) { - themePhrasesToRepeat = themeSplitter.SplitThemeIntoPhrases(theme); + _themePhrasesToRepeat = themeSplitter.SplitThemeIntoPhrases(theme); - foreach (var themePhraseToRepeat in themePhrasesToRepeat.ToList()) + foreach (var themePhraseToRepeat in _themePhrasesToRepeat.ToList()) { ResetPhraseEndOrnamentation(themePhraseToRepeat.Phrase[^1], compositionConfiguration.DefaultNoteTimeSpan); } @@ -49,14 +49,14 @@ public void AddTheme(BaroquenTheme theme) private bool AttemptToRepeatExistingThemePhrase(List measures) { - foreach (var themePhraseToRepeat in themePhrasesToRepeat.Where(themePhraseToRepeat => themePhraseToRepeat != themeCoolOffPhrase).OrderBy(static _ => ThreadLocalRandom.Next())) + foreach (var themePhraseToRepeat in _themePhrasesToRepeat.Where(themePhraseToRepeat => themePhraseToRepeat != _themeCoolOffPhrase).OrderBy(static _ => ThreadLocalRandom.Next())) { if (!TryRepeatPhrase(measures, themePhraseToRepeat)) { continue; } - themeCoolOffPhrase = themePhraseToRepeat; + _themeCoolOffPhrase = themePhraseToRepeat; logger.LogInfoMessage("Repeated main theme phrase."); @@ -70,24 +70,24 @@ private bool AttemptToRepeatExistingPhrase(List measures) { var minPhraseRepetitionPoolSize = compositionConfiguration.PhrasingConfiguration.MinPhraseRepetitionPoolSize; - if (phrasesToRepeat.Count < minPhraseRepetitionPoolSize) + if (_phrasesToRepeat.Count < minPhraseRepetitionPoolSize) { return false; } - foreach (var repeatedPhrase in phrasesToRepeat.OrderBy(static _ => ThreadLocalRandom.Next()).Where(repeatedPhrase => TryRepeatPhrase(measures, repeatedPhrase))) + foreach (var repeatedPhrase in _phrasesToRepeat.OrderBy(static _ => ThreadLocalRandom.Next()).Where(repeatedPhrase => TryRepeatPhrase(measures, repeatedPhrase))) { - phrasesToRepeat.Remove(repeatedPhrase); + _phrasesToRepeat.Remove(repeatedPhrase); - if (coolOffPhrases.Count >= minPhraseRepetitionPoolSize && coolOffPhrases.TryDequeue(out var coolOffPhrase)) + if (_coolOffPhrases.Count >= minPhraseRepetitionPoolSize && _coolOffPhrases.TryDequeue(out var coolOffPhrase)) { - phrasesToRepeat.Add(coolOffPhrase); + _phrasesToRepeat.Add(coolOffPhrase); } // If the phrase has not reached the maximum number of repetitions, add it to the cool off queue. if (repeatedPhrase.RepetitionCount < compositionConfiguration.PhrasingConfiguration.MaxPhraseRepetitions) { - coolOffPhrases.Enqueue(repeatedPhrase); + _coolOffPhrases.Enqueue(repeatedPhrase); } logger.LogInfoMessage("Repeated non-theme phrase."); @@ -120,7 +120,7 @@ private void AttemptToCreateAndRepeatNewPhrase(List measures) RepetitionCount = 1 }; - phrasesToRepeat.Add(repeatedPhrase); + _phrasesToRepeat.Add(repeatedPhrase); ResetPhraseEndOrnamentation(measures[^1], compositionConfiguration.DefaultNoteTimeSpan); diff --git a/src/BaroquenMelody.Library/Phrasing/ThemeSplitter.cs b/src/BaroquenMelody.Library/Phrasing/ThemeSplitter.cs index e6d34ffa..1c6f984f 100644 --- a/src/BaroquenMelody.Library/Phrasing/ThemeSplitter.cs +++ b/src/BaroquenMelody.Library/Phrasing/ThemeSplitter.cs @@ -5,7 +5,7 @@ namespace BaroquenMelody.Library.Phrasing; /// internal sealed class ThemeSplitter : IThemeSplitter { - private static readonly List<(int PhraseLength, int MaxStartIndex)> _phraseSplits = + private static readonly List<(int PhraseLength, int MaxStartIndex)> PhraseSplits = [ (2, 2), (3, 1), @@ -18,7 +18,7 @@ public List SplitThemeIntoPhrases(BaroquenTheme theme) .Select(static measure => new RepeatedPhrase { Phrase = [new Measure(measure)] }) .ToList(); - foreach (var (phraseLength, maxStartIndex) in _phraseSplits) + foreach (var (phraseLength, maxStartIndex) in PhraseSplits) { if (theme.Recapitulation.Count < phraseLength) { diff --git a/tests/BaroquenMelody.Infrastructure.Tests/Collections/FixedSizeListTests.cs b/tests/BaroquenMelody.Infrastructure.Tests/Collections/FixedSizeListTests.cs index 407247bb..5c0ef055 100644 --- a/tests/BaroquenMelody.Infrastructure.Tests/Collections/FixedSizeListTests.cs +++ b/tests/BaroquenMelody.Infrastructure.Tests/Collections/FixedSizeListTests.cs @@ -35,7 +35,7 @@ public void Add_WhenBelowCapacity_AddsItemToEnd() 2 }; - list.Should().Equal([1, 2]); + list.Should().Equal(1, 2); } [Test] @@ -48,7 +48,7 @@ public void Add_WhenAtCapacity_RemovesFirstItemAndAddsNewItemToEnd() 3 }; - list.Should().Equal([2, 3]); + list.Should().Equal(2, 3); } [Test] @@ -63,7 +63,7 @@ public void GetEnumerator_EnumeratesAllItems() var items = list.ToList(); - items.Should().Equal([1, 2, 3]); + items.Should().Equal(1, 2, 3); } [Test] @@ -118,6 +118,6 @@ public void NonGenericGetEnumerator_EnumeratesAllItems() items.Add(item); } - items.Should().Equal([1, 2, 3]); + items.Should().Equal(1, 2, 3); } } diff --git a/tests/BaroquenMelody.Library.Tests/Choices/DuetChordChoiceRepositoryTests.cs b/tests/BaroquenMelody.Library.Tests/Choices/DuetChordChoiceRepositoryTests.cs index 128e5b43..1cf70e26 100644 --- a/tests/BaroquenMelody.Library.Tests/Choices/DuetChordChoiceRepositoryTests.cs +++ b/tests/BaroquenMelody.Library.Tests/Choices/DuetChordChoiceRepositoryTests.cs @@ -85,29 +85,4 @@ public void WhenInvalidCompositionConfigurationIsPassedToDuetChordChoiceReposito // assert act.Should().Throw(); } - - [Test] - public void GetChordChoiceId_ReturnsExpectedId() - { - // arrange - var compositionConfiguration = TestCompositionConfigurations.Get(2); - - var duetChordChoiceRepository = new DuetChordChoiceRepository( - compositionConfiguration, - _mockNoteChoiceGenerator - ); - - // act - var id = duetChordChoiceRepository.GetChordChoiceId( - new ChordChoice( - [ - new NoteChoice(Instrument.One, NoteMotion.Ascending, 2), - new NoteChoice(Instrument.Two, NoteMotion.Descending, 3) - ] - ) - ); - - // assert - id.Should().Be(5); - } } diff --git a/tests/BaroquenMelody.Library.Tests/Choices/QuartetChordChoiceRepositoryTests.cs b/tests/BaroquenMelody.Library.Tests/Choices/QuartetChordChoiceRepositoryTests.cs index a27cf9dd..17206cda 100644 --- a/tests/BaroquenMelody.Library.Tests/Choices/QuartetChordChoiceRepositoryTests.cs +++ b/tests/BaroquenMelody.Library.Tests/Choices/QuartetChordChoiceRepositoryTests.cs @@ -109,31 +109,4 @@ public void WhenInvalidCompositionConfigurationIsPassedToQuartetChordChoiceRepos // assert act.Should().Throw(); } - - [Test] - public void GetChordChoiceId_ReturnsExpectedIndex() - { - // arrange - var compositionConfiguration = TestCompositionConfigurations.Get(); - - var quartetChordChoiceRepository = new QuartetChordChoiceRepository( - compositionConfiguration, - _mockNoteChoiceGenerator - ); - - // act - var id = quartetChordChoiceRepository.GetChordChoiceId( - new ChordChoice( - [ - new NoteChoice(Instrument.One, NoteMotion.Oblique, 0), - new NoteChoice(Instrument.Two, NoteMotion.Oblique, 0), - new NoteChoice(Instrument.Three, NoteMotion.Oblique, 0), - new NoteChoice(Instrument.Four, NoteMotion.Ascending, 2) - ] - ) - ); - - // assert - id.Should().Be(1); - } } diff --git a/tests/BaroquenMelody.Library.Tests/Choices/SoloChordChoiceRepositoryTests.cs b/tests/BaroquenMelody.Library.Tests/Choices/SoloChordChoiceRepositoryTests.cs index 58b45b7d..ee547e41 100644 --- a/tests/BaroquenMelody.Library.Tests/Choices/SoloChordChoiceRepositoryTests.cs +++ b/tests/BaroquenMelody.Library.Tests/Choices/SoloChordChoiceRepositoryTests.cs @@ -64,28 +64,4 @@ public void WhenInvalidCompositionConfigurationIsPassedToSoloChordChoiceReposito // assert act.Should().Throw(); } - - [Test] - public void GetChordChoiceId_ReturnsExpectedId() - { - // arrange - var compositionConfiguration = TestCompositionConfigurations.Get(1); - - var soloChordChoiceRepository = new SoloChordChoiceRepository( - compositionConfiguration, - _mockNoteChoiceGenerator - ); - - // act - var id = soloChordChoiceRepository.GetChordChoiceId( - new ChordChoice( - [ - new NoteChoice(Instrument.One, NoteMotion.Ascending, 2) - ] - ) - ); - - // assert - id.Should().Be(1); - } } diff --git a/tests/BaroquenMelody.Library.Tests/Choices/TrioChordChoiceRepositoryTests.cs b/tests/BaroquenMelody.Library.Tests/Choices/TrioChordChoiceRepositoryTests.cs index eba94437..ed13c5bc 100644 --- a/tests/BaroquenMelody.Library.Tests/Choices/TrioChordChoiceRepositoryTests.cs +++ b/tests/BaroquenMelody.Library.Tests/Choices/TrioChordChoiceRepositoryTests.cs @@ -97,30 +97,4 @@ public void WhenInvalidCompositionConfigurationIsPassedToQuartetChordChoiceRepos // assert act.Should().Throw(); } - - [Test] - public void GetChordChoiceId_ReturnsExpectedId() - { - // arrange - var compositionConfiguration = TestCompositionConfigurations.Get(3); - - var trioChordChoiceRepository = new TrioChordChoiceRepository( - compositionConfiguration, - _mockNoteChoiceGenerator - ); - - // act - var id = trioChordChoiceRepository.GetChordChoiceId( - new ChordChoice( - [ - new NoteChoice(Instrument.One, NoteMotion.Oblique, 0), - new NoteChoice(Instrument.Two, NoteMotion.Oblique, 0), - new NoteChoice(Instrument.Three, NoteMotion.Ascending, 2) - ] - ) - ); - - // assert - id.Should().Be(1); - } }