public void MusicPlayer_Play_Play_Do_No_Change() { //arrange IMusicFactory imf = Substitute.For<IMusicFactory>(); IInternalPlayer iip = Substitute.For<IInternalPlayer>(); imf.GetInternalPlayer().Returns(iip); IReadOnlyPlayList irop = Substitute.For<IReadOnlyPlayList>(); IInternalTrack it = Substitute.For<IInternalTrack>(); it.Path.Returns("MyPath"); irop.CurrentTrack.Returns(it); irop.When(x => x.Init()).Do(x => irop.CurrentTrack.Returns(it)); // act MusicPlayer target = new MusicPlayer(imf); target.PlayList = irop; target.Mode.Should().Be(PlayMode.Play); target.MonitorEvents(); target.Mode = PlayMode.Play; //assert target.ShouldNotRaisePropertyChangeFor(t => t.Mode); target.Mode.Should().Be(PlayMode.Play); }
public void MusicPlayer_Set_PlayList_Twice() { //arrange IMusicFactory imf = Substitute.For<IMusicFactory>(); IInternalPlayer iip = Substitute.For<IInternalPlayer>(); imf.GetInternalPlayer().Returns(iip); MusicPlayer target = new MusicPlayer(imf); IReadOnlyPlayList irop = Substitute.For<IReadOnlyPlayList>(); irop.CurrentTrack = null; target.PlayList = irop; //act target.MonitorEvents(); target.PlayList = irop; //assert target.PlayList.Should().Be(irop); target.ShouldNotRaisePropertyChangeFor(t => t.PlayList); target.Mode.Should().Be(PlayMode.Stopped); target.Dispose(); }