private void UnhandledViewBindingEventHandler(object sender, VueBindingUnhandledViewBindingEventArgs e)
        {
            Guid noteId;

            switch (e.PropertyName)
            {
            case "AddToSafeCommand":
                noteId = new Guid(e.Value);
                _viewModel.AddNoteToSafe(noteId);
                SetVisibilityAddRemoveTresor(noteId, true);
                break;

            case "RemoveFromSafeCommand":
                noteId = new Guid(e.Value);
                _viewModel.RemoveNoteFromSafe(noteId);
                SetVisibilityAddRemoveTresor(noteId, false);
                break;

            case "OrderChangedCommand":
                int oldIndex = int.Parse(e.Parameters["oldIndex"]);
                int newIndex = int.Parse(e.Parameters["newIndex"]);
                _viewModel.MoveNote(oldIndex, newIndex);
                _viewModel.CheckPinStatusAtPosition(newIndex);
                break;
            }
        }
        public void CheckPinStatusAtPosition_DoesNotChangePinStateIfNotNecessary()
        {
            NoteRepositoryModel model = CreateTestRepository();

            model.Notes[0].IsPinned = false;
            model.Notes[1].IsPinned = false;
            model.Notes[2].IsPinned = false;

            NoteRepositoryViewModel viewModel = CreateMockedNoteRepositoryViewModel(model);

            viewModel.CheckPinStatusAtPosition(0);
            Assert.IsFalse(model.Notes[0].IsPinned);

            model.Notes[0].IsPinned = true;
            model.Notes[1].IsPinned = true;
            model.Notes[2].IsPinned = true;
            viewModel.CheckPinStatusAtPosition(0);
            Assert.IsTrue(model.Notes[0].IsPinned);
        }
        public void CheckPinStatusAtPosition_PinsNoteIfDraggedAboveLastPinnedNote()
        {
            NoteRepositoryModel model = CreateTestRepository();

            // Note0 was dragged above Note1
            model.Notes[0].IsPinned = false;
            model.Notes[1].IsPinned = true;
            model.Notes[2].IsPinned = false;

            NoteRepositoryViewModel viewModel = CreateMockedNoteRepositoryViewModel(model);

            viewModel.CheckPinStatusAtPosition(0);
            Assert.IsTrue(model.Notes[0].IsPinned);
        }
        public void CheckPinStatusAtPosition_UnpinsNoteIfDraggedBelowFirstUnpinnedNote()
        {
            NoteRepositoryModel model = CreateTestRepository();

            // Note2 was dragged below Note1
            model.Notes[0].IsPinned = true;
            model.Notes[1].IsPinned = false;
            model.Notes[2].IsPinned = true;

            NoteRepositoryViewModel viewModel = CreateMockedNoteRepositoryViewModel(model);

            viewModel.CheckPinStatusAtPosition(2);
            Assert.IsFalse(model.Notes[2].IsPinned);
        }