Beispiel #1
0
    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>();
    }
Beispiel #2
0
    /// <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));
    }
Beispiel #3
0
    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);
    }
Beispiel #4
0
    /// <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));
    }
Beispiel #5
0
 public string BuildAssetRenditionsUrl(AssetRenditionIdentifier identifier) => GetProjectUrl(
     string.Concat(
         _assetTemplate.GetIdentifierUrlSegment(identifier.AssetIdentifier),
         _assetRenditionTemplate.GetIdentifierUrlSegment(identifier.RenditionIdentifier)));