diff --git a/Selector.Tests/Consumer/AudioInjector.cs b/Selector.Tests/Consumer/AudioInjector.cs index 70b3727..0be1ba4 100644 --- a/Selector.Tests/Consumer/AudioInjector.cs +++ b/Selector.Tests/Consumer/AudioInjector.cs @@ -70,7 +70,7 @@ namespace Selector.Tests } [Fact] - public async void Callback() + public async void CallbackNoId() { var watcherMock = new Mock(); var spotifyMock = new Mock(); @@ -92,6 +92,34 @@ namespace Selector.Tests await featureInjector.AsyncCallback(eventArgsMock.Object); + spotifyMock.VerifyNoOtherCalls(); + timelineMock.VerifyNoOtherCalls(); + } + + [Fact] + public async void CallbackWithId() + { + var watcherMock = new Mock(); + var spotifyMock = new Mock(); + var timelineMock = new Mock(); + var eventArgsMock = new Mock(); + var playingMock = new Mock(); + var trackMock = new Mock(); + var featureMock = new Mock(); + + eventArgsMock.Object.Current = playingMock.Object; + playingMock.Object.Item = trackMock.Object; + trackMock.Object.Id = "Fake-Id"; + + spotifyMock.Setup(m => m.GetAudioFeatures(It.IsAny()).Result).Returns(() => featureMock.Object); + + var featureInjector = new AudioFeatureInjector(watcherMock.Object, spotifyMock.Object) + { + Timeline = timelineMock.Object + }; + + await featureInjector.AsyncCallback(eventArgsMock.Object); + spotifyMock.Verify(m => m.GetAudioFeatures(It.IsAny())); spotifyMock.VerifyNoOtherCalls();