Exemplo n.º 1
0
 public void DocumentVM_CM_DeleteLine_RemovesChordLine()
 {
     FakeDocumentViewModel document = new FakeDocumentViewModel();
     var line = new ChordLine();
     document.ChordLines.Add(line);
     document.SelectedChordLine = line;
     document.CM_DeleteLine.Execute(null);
     Assert.AreEqual(document.ChordLines.Count, 0, "There should be 0 lines now.");
 }
Exemplo n.º 2
0
 public override void Open(ref DocumentViewModel document)
 {
     var line = new ChordLine();
     line.Chords.Add(new Chord{ Name = "C"});
     line.Chords.Add(new Chord{ Name = "F"});
     line.Chords.Add(new Chord{ Name = "G"});
     document.ChordLines.Add(line);
     document.DocumentPath = "C:\\MyDocument.chords";
 }
Exemplo n.º 3
0
 public void DocumentVM_DeleteSelectedChord_DeletesTheChord()
 {
     FakeDocumentViewModel document = new FakeDocumentViewModel();
     var line = new ChordLine();
     var chord = new Chord();
     line.Chords.Add(chord);
     document.ChordLines.Add(line);
     document.SelectedChord = chord;
     document.DeleteSelectedChord();
     Assert.IsNull(document.SelectedChord, "SelectedChord should be null.");
     Assert.AreEqual(line.Chords.Count, 0, "There should be 0 chords in the line now.");
 }
Exemplo n.º 4
0
        public void DocumentVM_ChordLinesCollectionChanged_UpdatesNewFirstLine()
        {
            DocumentViewModel doc = new DocumentViewModel();
            var line1 = new ChordLine();
            var line2 = new ChordLine();
            var line3 = new ChordLine();
            doc.ChordLines.Add(line1);
            doc.ChordLines.Add(line2);
            doc.ChordLines.Add(line3);

            Assert.IsTrue(line1.FirstLine == true, "Line 1 should now be 'FirstLine'.");
            doc.ChordLines.Remove(line1);
            doc.ChordLines.Remove(line2);
            Assert.IsTrue(line3.FirstLine == true, "Line 3 should now be 'FirstLine'.");
        }
Exemplo n.º 5
0
 public void MainWindowVM_TransposeDown_AllChordsWereTransposed()
 {
     var model = new MainWindowModel();
     var doc = new DocumentViewModel(model);
     var chordLine = new ChordLine();
     var chordA = new StubbChord();
     var chordB = new StubbChord();
     chordLine.Chords.Add(chordA);
     chordLine.Chords.Add(chordB);
     doc.ChordLines.Add(chordLine);
     model.Documents.Add(doc);
     model.TransposeDown.Execute(null);
     var wasTransposed = (chordA.WasTransposedDown && chordB.WasTransposedDown);
     Assert.IsTrue(wasTransposed, "All chords should have been transposed");
 }
Exemplo n.º 6
0
 private void MouseRightDownCommandExecute(MouseEventArgs param)
 {
     Point p = param.GetPosition(param.Source as UIElement);
     var res = VisualTreeHelper.HitTest(param.Source as UIElement, p);
     var chordLine = Ancestors.FindAncestorOfType<ChordLineView>(res.VisualHit);
     if (chordLine != null)
     {
         _selectedChordLineView = chordLine as ChordLineView;
         _selectedChordLine = (_selectedChordLineView.DataContext as ChordLine);
     }
     else
     {
         _selectedChordLineView = null;
         _selectedChordLine = null;
     }
 }