Example #1
0
 public void convertSDKToSDK()
 {
     sdkVisibilityConfiguration1 = CreateTypicalSDKDocumentVisibilityConfiguration();
     sdkVisibilityConfiguration2 = new DocumentVisibilityConfigurationConverter(sdkVisibilityConfiguration1).ToSDKVisibilityConfiguration();
     Assert.IsNotNull(sdkVisibilityConfiguration2);
     Assert.AreEqual(sdkVisibilityConfiguration1, sdkVisibilityConfiguration2);
 }
Example #2
0
        public DocumentVisibilityConfiguration Build()
        {
            DocumentVisibilityConfiguration configuration = new DocumentVisibilityConfiguration();

            configuration.DocumentUid = documentId;
            configuration.AddSignerIds(signerIds);
            return(configuration);
        }
Example #3
0
        public void convertSDKToAPI()
        {
            sdkVisibilityConfiguration1 = CreateTypicalSDKDocumentVisibilityConfiguration();
            apiVisibilityConfiguration1 = new DocumentVisibilityConfigurationConverter(sdkVisibilityConfiguration1).ToAPIVisibilityConfiguration();

            Assert.IsNotNull(apiVisibilityConfiguration1);
            Assert.AreEqual(sdkVisibilityConfiguration1.DocumentUid, apiVisibilityConfiguration1.DocumentUid);
            Assert.AreEqual(2, apiVisibilityConfiguration1.RoleUids.Count);
            CollectionAssert.AreEqual(sdkVisibilityConfiguration1.SignerIds, apiVisibilityConfiguration1.RoleUids);
        }
Example #4
0
        public void convertAPIToSDK()
        {
            apiVisibilityConfiguration1 = CreateTypicalAPIDocumentVisibilityConfiguration();
            sdkVisibilityConfiguration1 = new DocumentVisibilityConfigurationConverter(apiVisibilityConfiguration1).ToSDKVisibilityConfiguration();

            Assert.IsNotNull(sdkVisibilityConfiguration1);
            Assert.AreEqual(apiVisibilityConfiguration1.DocumentUid, sdkVisibilityConfiguration1.DocumentUid);
            Assert.AreEqual(2, sdkVisibilityConfiguration1.SignerIds.Count);
            CollectionAssert.AreEqual(apiVisibilityConfiguration1.RoleUids, sdkVisibilityConfiguration1.SignerIds);
        }
Example #5
0
 private DocumentVisibilityConfiguration FindSameDocumentIdConfiguration(DocumentVisibilityConfiguration configuration)
 {
     foreach (DocumentVisibilityConfiguration documentVisibilityConfiguration in configurations)
     {
         if (string.Equals(documentVisibilityConfiguration.DocumentUid, configuration.DocumentUid))
         {
             return(documentVisibilityConfiguration);
         }
     }
     return(null);
 }
Example #6
0
        public List <Signer> GetSigners(DocumentPackage documentPackage, string documentId)
        {
            List <Signer> signers = new List <Signer>();
            DocumentVisibilityConfiguration configuration = GetConfiguration(documentId);

            foreach (Signer signer in documentPackage.Signers)
            {
                if (configuration != null && configuration.SignerIds.Contains(signer.Id))
                {
                    signers.Add(signer);
                }
            }
            return(signers);
        }
Example #7
0
        public List <Document> GetDocuments(DocumentPackage documentPackage, string signerId)
        {
            List <Document> documents = new List <Document>();

            foreach (Document document in documentPackage.Documents)
            {
                DocumentVisibilityConfiguration configuration = GetConfiguration(document.Id);
                if (configuration != null && configuration.SignerIds.Contains(signerId))
                {
                    documents.Add(document);
                }
            }
            return(documents);
        }
Example #8
0
        private void MergeConfiguration(DocumentVisibilityConfiguration configuration)
        {
            DocumentVisibilityConfiguration foundConfiguration = FindSameDocumentIdConfiguration(configuration);

            if (foundConfiguration != null)
            {
                List <string> signerIds = foundConfiguration.SignerIds;
                foreach (string signerId in configuration.SignerIds)
                {
                    if (!signerIds.Contains(signerId))
                    {
                        signerIds.Add(signerId);
                    }
                }
            }
            else
            {
                configurations.Add(configuration);
            }
        }
Example #9
0
 public void convertNullSDKToSDK()
 {
     sdkVisibilityConfiguration1 = null;
     converter = new DocumentVisibilityConfigurationConverter(sdkVisibilityConfiguration1);
     Assert.IsNull(converter.ToSDKVisibilityConfiguration());
 }
Example #10
0
 public DocumentVisibilityBuilder AddConfiguration(DocumentVisibilityConfiguration configuration)
 {
     this.configurations.Add(configuration);
     return(this);
 }
 public DocumentVisibilityConfigurationConverter(DocumentVisibilityConfiguration sdkConfiguration)
 {
     this.sdkConfiguration = sdkConfiguration;
 }