From e6be7df9123bf77440bdc874b59dbf7c3c1c6de8 Mon Sep 17 00:00:00 2001 From: andy Date: Sat, 18 Jun 2022 11:02:02 +0100 Subject: [PATCH] fixing test with no audio features id --- Selector.Tests/Consumer/AudioInjector.cs | 30 +++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) 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();