fixing test with no audio features id

This commit is contained in:
andy 2022-06-18 11:02:02 +01:00
parent 2a8b739f8d
commit e6be7df912

View File

@ -70,7 +70,7 @@ namespace Selector.Tests
} }
[Fact] [Fact]
public async void Callback() public async void CallbackNoId()
{ {
var watcherMock = new Mock<IPlayerWatcher>(); var watcherMock = new Mock<IPlayerWatcher>();
var spotifyMock = new Mock<ITracksClient>(); var spotifyMock = new Mock<ITracksClient>();
@ -92,6 +92,34 @@ namespace Selector.Tests
await featureInjector.AsyncCallback(eventArgsMock.Object); await featureInjector.AsyncCallback(eventArgsMock.Object);
spotifyMock.VerifyNoOtherCalls();
timelineMock.VerifyNoOtherCalls();
}
[Fact]
public async void CallbackWithId()
{
var watcherMock = new Mock<IPlayerWatcher>();
var spotifyMock = new Mock<ITracksClient>();
var timelineMock = new Mock<AnalysedTrackTimeline>();
var eventArgsMock = new Mock<ListeningChangeEventArgs>();
var playingMock = new Mock<CurrentlyPlayingContext>();
var trackMock = new Mock<FullTrack>();
var featureMock = new Mock<TrackAudioFeatures>();
eventArgsMock.Object.Current = playingMock.Object;
playingMock.Object.Item = trackMock.Object;
trackMock.Object.Id = "Fake-Id";
spotifyMock.Setup(m => m.GetAudioFeatures(It.IsAny<string>()).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<string>())); spotifyMock.Verify(m => m.GetAudioFeatures(It.IsAny<string>()));
spotifyMock.VerifyNoOtherCalls(); spotifyMock.VerifyNoOtherCalls();