public async void GetAlbum_ById_0_Returns_Null() { var albumId = 0; For <IMediator>() .Setup(m => m.Send(It.IsAny <AlbumQuery>(), default(CancellationToken))) .Returns(Task.FromResult <AlbumModel>(null)).Verifiable(); var result = await ObjectUnderTest.GetAlbum(albumId); result.ShouldBeNull(); For <IMediator>().Verify(); }
public async void GetAlbum_ById_Non_0_Returns_Valid_Album() { var albumId = 1; var fix = new Fixture(); var album = fix.Create <AlbumModel>(); For <IMediator>() .Setup(m => m.Send(It.IsAny <AlbumQuery>(), default(CancellationToken))) .Returns(Task.FromResult(album)).Verifiable(); var result = await ObjectUnderTest.GetAlbum(albumId); result.ShouldNotBeNull(); result.ShouldBeEquivalentTo(album); For <IMediator>().Verify(); }