public void Should_return_NotFound_with_incorrect_artist() { _reader.Stub(x => x.ReadFromFile(0)).IgnoreArguments().Throw(new FileNotFoundException()); var artistHandler = new ArtistHandler(_writer, _reader, _operationOutput); var operationResult = artistHandler.Put(new Artist { Id = 1, Genre = "r", Name = "r" }); Assert.That(operationResult.StatusCode, Is.EqualTo(404)); }
public void Should_return_InternalServerError_on_exception() { _reader.Stub(x => x.ReadFromFile(0)).IgnoreArguments().Throw(new Exception()); var artistHandler = new ArtistHandler(_writer, _reader, _operationOutput); var operationResult = artistHandler.Put(new Artist { Id = 1, Genre = "r", Name = "r" }); Assert.That(operationResult.StatusCode, Is.EqualTo(500)); }
public void Should_return_NoContent_on_successful_update() { var artistHandler = new ArtistHandler(_writer, _reader, _operationOutput); var artist = new Artist { Id = 1, Genre = "r", Name = "r" }; _reader.Stub(x => x.ReadFromFile(0)).IgnoreArguments().Return(artist); var operationResult = artistHandler.Put(artist); Assert.That(operationResult.StatusCode, Is.EqualTo(204)); }