Пример #1
0
        public DocumentVisibilityConfiguration Build()
        {
            DocumentVisibilityConfiguration configuration = new DocumentVisibilityConfiguration();

            configuration.DocumentUid = documentId;
            configuration.AddSignerIds(signerIds);
            return(configuration);
        }
        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);
        }
        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);
        }
 private DocumentVisibilityConfiguration FindSameDocumentIdConfiguration(DocumentVisibilityConfiguration configuration)
 {
     foreach (DocumentVisibilityConfiguration documentVisibilityConfiguration in configurations)
     {
         if (string.Equals(documentVisibilityConfiguration.DocumentUid, configuration.DocumentUid))
         {
             return(documentVisibilityConfiguration);
         }
     }
     return(null);
 }
Пример #5
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);
        }
Пример #6
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);
        }
        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);
            }
        }
Пример #8
0
 public DocumentVisibilityBuilder AddConfiguration(DocumentVisibilityConfiguration configuration)
 {
     this.configurations.Add(configuration);
     return(this);
 }
 public void convertSDKToSDK() {
     sdkVisibilityConfiguration1 = CreateTypicalSDKDocumentVisibilityConfiguration();
     sdkVisibilityConfiguration2 = new DocumentVisibilityConfigurationConverter(sdkVisibilityConfiguration1).ToSDKVisibilityConfiguration();
     Assert.IsNotNull(sdkVisibilityConfiguration2);
     Assert.AreEqual(sdkVisibilityConfiguration1, sdkVisibilityConfiguration2);
 }
 public void convertNullSDKToSDK() {
     sdkVisibilityConfiguration1 = null;
     converter = new DocumentVisibilityConfigurationConverter(sdkVisibilityConfiguration1);
     Assert.IsNull(converter.ToSDKVisibilityConfiguration());
 }
 public DocumentVisibilityConfigurationConverter(DocumentVisibilityConfiguration sdkConfiguration)
 {
     this.sdkConfiguration = sdkConfiguration;
 }