public async Task UpdateRenditionAsync_ByCombinationOfInternalAndExternalIds_UpdatesRenditions(Reference assetReference, Reference renditionReference) { var client = _fileSystemFixture.CreateMockClientWithResponse("AssetRendition.json"); var expected = _fileSystemFixture.GetExpectedResponse <AssetRenditionModel>("AssetRendition.json"); var updateModel = new AssetRenditionUpdateModel() { Transformation = new RectangleResizeTransformation { CustomWidth = 120, CustomHeight = 240, X = 300, Y = 200, Width = 360, Height = 720, } }; var response = await client.UpdateAssetRenditionAsync(new AssetRenditionIdentifier(assetReference, renditionReference), updateModel); using (new AssertionScope()) { response.Transformation.Should().BeEquivalentTo(updateModel.Transformation); response.ExternalId.Should().BeEquivalentTo(expected.ExternalId); response.AssetId.Should().Be(expected.AssetId); response.RenditionId.Should().Be(expected.RenditionId); } }
public async Task UpdateRenditionAsync_IdentifierIsNull_Throws() { var client = _fileSystemFixture.CreateMockClientWithResponse("AssetRendition.json"); var updateModel = new AssetRenditionUpdateModel { Transformation = new RectangleResizeTransformation { CustomWidth = 120, CustomHeight = 240, X = 300, Y = 200, Width = 360, Height = 720, } }; await client.Invoking(x => x.UpdateAssetRenditionAsync(null, updateModel)) .Should().ThrowExactlyAsync <ArgumentNullException>(); }
/// <inheritdoc /> public async Task <AssetRenditionModel> UpdateAssetRenditionAsync(AssetRenditionIdentifier identifier, AssetRenditionUpdateModel updateModel) { if (identifier == null) { throw new ArgumentNullException(nameof(identifier)); } if (updateModel == null) { throw new ArgumentNullException(nameof(updateModel)); } var endpointUrl = _urlBuilder.BuildAssetRenditionsUrl(identifier); return(await _actionInvoker.InvokeMethodAsync <AssetRenditionUpdateModel, AssetRenditionModel>(endpointUrl, HttpMethod.Put, updateModel)); }