示例#1
0
        private void InitMp3SongViewModel(bool paramFileExists, IDialogService paramDialogService)
        {
            MockMp3File      mp3File      = new MockMp3File(InitTitle, InitArtist, InitAlbum);
            MockFileModifier fileModifier = new MockFileModifier(paramFileExists);

            Mp3Song tempMp3Song = new Mp3Song(mp3File, fileModifier);

            this.mp3SongViewModel = new Mp3SongViewModel(tempMp3Song, paramDialogService);
        }
示例#2
0
        public void CheckIfMp3SongWasRemovedFromList()
        {
            // Arrange
            Mp3SongViewModel mp3SongViewModel = this.dataGridViewModel.Mp3SongViewModels[0];

            // Act
            this.dataGridViewModel.Remove(mp3SongViewModel);

            // Assert
            Assert.AreEqual(0, this.dataGridViewModel.Mp3SongViewModels.Count);
        }
示例#3
0
        public void DontRemoveMp3SongThatIsNotInList()
        {
            // Arrange
            Mp3SongViewModel newMp3SongViewModel = new Mp3SongViewModel(new Mp3Song(new MockMp3File(), new MockFileModifier(false)), this.dialogServiceYes);

            // Act
            this.dataGridViewModel.Remove(newMp3SongViewModel);

            // Assert
            Assert.AreEqual(1, this.dataGridViewModel.Mp3SongViewModels.Count);
        }
示例#4
0
        public void GetRemovedMp3SongFromMessage()
        {
            // Assert
            Mp3SongViewModel notificationValue = null;

            Messenger.Default.Register <NotificationMessage <Mp3SongViewModel> >(this, x => notificationValue = x.Content);

            // Act
            this.mp3SongViewModel.Commands
            .Find(x => x.CommandName == Resources.CommandName_Remove)
            .RelayCommand.Execute(this);

            // Assert
            Assert.AreEqual(this.mp3SongViewModel, notificationValue);
        }
示例#5
0
        public void GetSavedMp3SongFromMessageWhenDialogResultIsYes()
        {
            this.InitMp3SongViewModel(true, this.dialogServiceYes);
            Mp3SongViewModel notificationValue = null;

            Messenger.Default.Register <NotificationMessage <Mp3SongViewModel> >(this, x => notificationValue = x.Content);

            // Act
            this.mp3SongViewModel.Title = "newValue";

            this.mp3SongViewModel.Commands
            .Find(x => x.CommandName == Resources.CommandName_Remove)
            .RelayCommand.Execute(this);

            // Assert
            Assert.IsFalse(notificationValue.InEditMode);
        }