public async void Update_Album_ById_0_Returns_Bad_Request() { var fix = new Fixture(); var album = fix.Create <AlbumModel>(); album.Id = 0; IHttpActionResult model = await ObjectUnderTest.UpdateAlbum(album); model.ShouldNotBeNull(); model.ShouldNotBeOfType <OkNegotiatedContentResult <AlbumModel> >(); model.ShouldBeOfType <BadRequestResult>(); }
public async void UpdateAlbum_InValid_Request_Returns_False() { var fix = new Fixture(); var invalidAlbum = fix.Create <AlbumModel>(); For <IMediator>() .Setup(m => m.Send(It.IsAny <UpdateAlbumCommand>(), default(CancellationToken))) .Returns(Task.FromResult(false)).Verifiable(); var result = await ObjectUnderTest.UpdateAlbum(invalidAlbum); result.ShouldBeFalse(); For <IMediator>().Verify(); }
public async void Update_Album_ById_Non_0_ISE_Returns_ISE() { var fix = new Fixture(); var album = fix.Create <AlbumModel>(); var nonZeroAlbumId = 2; album.Id = nonZeroAlbumId; For <IAlbumService>() .Setup(s => s.UpdateAlbum(It.IsAny <AlbumModel>())) .Returns(Task.FromResult(false)).Verifiable(); IHttpActionResult result = await ObjectUnderTest.UpdateAlbum(album); result.ShouldNotBeNull(); result.ShouldNotBeOfType <BadRequestResult>(); result.ShouldNotBeOfType <OkNegotiatedContentResult <AlbumModel> >(); result.ShouldBeOfType <ExceptionResult>(); For <IAlbumService>().Verify(); }