-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from criipto/mutation-ChangeSignatory
add support for ChangeSignatory mutation
- Loading branch information
Showing
4 changed files
with
166 additions
and
7 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
Criipto.Signatures.IntegrationTests/ChangeSignatoryTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using Xunit; | ||
using Criipto.Signatures; | ||
using Criipto.Signatures.Models; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
namespace Criipto.Signatures.IntegrationTests; | ||
|
||
public class ChangeSignatoryTests | ||
{ | ||
|
||
[Fact] | ||
public async void MutationChangesEvidenceProviders() | ||
{ | ||
using (var client = new CriiptoSignaturesClient(Dsl.CLIENT_ID, Dsl.CLIENT_SECRET, "test")) | ||
{ | ||
// Arrange | ||
var signatureOrder = await client.CreateSignatureOrder( | ||
new CreateSignatureOrderInput() | ||
{ | ||
title = "Title", | ||
expiresInDays = 1, | ||
documents = new List<DocumentInput>(){ | ||
new DocumentInput { | ||
pdf = | ||
new PadesDocumentInput | ||
{ | ||
title = "TEST", | ||
blob = Dsl.Sample | ||
} | ||
} | ||
}, | ||
evidenceProviders = new List<EvidenceProviderInput>() { | ||
new EvidenceProviderInput() { | ||
enabledByDefault = false, | ||
drawable = new DrawableEvidenceProviderInput() { | ||
requireName = true | ||
} | ||
} | ||
} | ||
} | ||
); | ||
|
||
var signatory = await client.AddSignatory( | ||
signatureOrder | ||
); | ||
|
||
var soDrawable = | ||
signatureOrder!.evidenceProviders | ||
.Where(e => e is DrawableSignatureEvidenceProvider) | ||
.First(); | ||
|
||
// Act | ||
var actual = await client.ChangeSignatory( | ||
signatory, | ||
new ChangeSignatoryInput() | ||
{ | ||
evidenceProviders = new List<SignatoryEvidenceProviderInput>() { | ||
new SignatoryEvidenceProviderInput() { | ||
id = soDrawable.id | ||
} | ||
} | ||
} | ||
); | ||
|
||
// Assert | ||
Assert.NotNull(signatory?.id); | ||
Assert.NotNull(signatory?.href); | ||
|
||
var drawable = | ||
actual!.evidenceProviders | ||
.Where(e => e is DrawableSignatureEvidenceProvider) | ||
.First(); | ||
Assert.NotNull(drawable); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters