public async Task UpdateRenditionAsync_CreateModelIsNull_Throws() { var client = _fileSystemFixture.CreateMockClientWithResponse("AssetRendition.json"); var identifier = new AssetRenditionIdentifier(Reference.ByExternalId("asset-1"), Reference.ByExternalId("rendition-1")); await client.Invoking(x => x.UpdateAssetRenditionAsync(identifier, null)) .Should().ThrowExactlyAsync <ArgumentNullException>(); }
/// <inheritdoc /> public async Task <AssetRenditionModel> GetAssetRenditionAsync(AssetRenditionIdentifier identifier) { if (identifier == null) { throw new ArgumentNullException(nameof(identifier)); } var endpointUrl = _urlBuilder.BuildAssetRenditionsUrl(identifier); return(await _actionInvoker.InvokeReadOnlyMethodAsync <AssetRenditionModel>(endpointUrl, HttpMethod.Get)); }
public async Task GetRenditionAsync_ByCombinationOfInternalAndExternalIds_ReturnsRendition(Reference assetReference, Reference renditionReference) { var client = _fileSystemFixture.CreateMockClientWithResponse("AssetRendition.json"); var expected = _fileSystemFixture.GetExpectedResponse <AssetRenditionModel>("AssetRendition.json"); var identifier = new AssetRenditionIdentifier(assetReference, renditionReference); var response = await client.GetAssetRenditionAsync(identifier); response.Should().BeEquivalentTo(expected); }
/// <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)); }
public string BuildAssetRenditionsUrl(AssetRenditionIdentifier identifier) => GetProjectUrl( string.Concat( _assetTemplate.GetIdentifierUrlSegment(identifier.AssetIdentifier), _assetRenditionTemplate.GetIdentifierUrlSegment(identifier.RenditionIdentifier)));