public void ChordServiceShouldReturnAChordDescriptionForAFoundChord() { // Arrange var expected = new Chord(1, "C", new Collection <Fingering> { new Fingering { Fret = 0, String = StringEnum.B }, new Fingering { Fret = 1, String = StringEnum.D }, new Fingering { Fret = 2, String = StringEnum.A } } ); var mockChordRepository = A.Fake <IChordRepository>(); A.CallTo(() => mockChordRepository .GetByChordName("C")) .Returns(expected); // Act var sut = new ChordService(mockChordRepository); var result = sut.GetChord("C"); // Assert Assert.Equal(expected, result); }
static ViewModelLocator() { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); var chordService = new ChordService(); chordService.LoadChords(); SimpleIoc.Default.Register<IChordService>(() => chordService); SimpleIoc.Default.Register<MainViewModel>(); SimpleIoc.Default.Register<ChordsListViewModel>(); }
static ViewModelLocator() { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); var chordService = new ChordService(); chordService.LoadChords(); SimpleIoc.Default.Register <IChordService>(() => chordService); SimpleIoc.Default.Register <MainViewModel>(); SimpleIoc.Default.Register <ChordsListViewModel>(); }
public void AMajorChord() { var noteService = new NoteService(); var intervalService = new IntervalService(); var noteIntervalService = new NoteIntervalService(noteService, intervalService); var chordService = new ChordService(noteIntervalService, noteService); var aMajorChord = chordService.GetChord("A", Core.Chords.Major); Assert.NotNull(aMajorChord); Assert.Equal("A", aMajorChord.Key.Name); // notes. Assert.Equal("A", aMajorChord.Notes[0].Name); Assert.Equal("C#", aMajorChord.Notes[1].Name); Assert.Equal("E", aMajorChord.Notes[2].Name); }
static void Main(string[] args) { var optionsBuilder = new DbContextOptionsBuilder <MusicToolsContext>(); optionsBuilder.UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=MusicTools ;Trusted_Connection=True;MultipleActiveResultSets=true"); var context = new MusicToolsContext(optionsBuilder.Options); var chordService = new ChordService(new NoteService(new KeyService(), new IntervalService()), new ChordQualityService(context)); Stopwatch sw = new Stopwatch(); sw.Start(); var chords = chordService.GetChords(new Note(Key.D), new Note(Key.A, Alteration.Flat), new Note(Key.C)).ToList(); Console.WriteLine($"{sw.ElapsedMilliseconds} ms"); Console.Read(); }
public void SetUp() { _chordService = new ChordService(); }
public ChordSequenceServiceShould() { this.chordService = new ChordService(mockChordUnitRepository.Object); }