private OneSpanSign.Sdk.ConditionalField CreateTypicalSDKConditionalField()
        {
            OneSpanSign.Sdk.ConditionalField sdkField = new OneSpanSign.Sdk.ConditionalField();
            sdkField.Extract = false;
            sdkField.Height  = 100.0;
            sdkField.X       = 10.0;
            sdkField.Id      = "3";
            sdkField.Name    = "Field Name";
            sdkField.Page    = 1;
            sdkField.Y       = 101.0;
            sdkField.Style   = FieldStyle.BOUND_DATE;
            sdkField.Value   = "field value";
            sdkField.Width   = 102.0;

            FieldCondition condition = new FieldCondition();

            condition.Id        = "ConditionId";
            condition.Condition = "document['DocumentId'].field['fieldId2'].value == 'X'";
            condition.Action    = "document['DocumentId'].field['fieldId1'].disabled = true";
            List <FieldCondition> conditions = new List <FieldCondition> ();

            conditions.Add(condition);
            sdkField.Conditions = conditions;

            return(sdkField);
        }
 public void ConvertSDKToSDK()
 {
     sdkField1 = CreateTypicalSDKConditionalField();
     converter = new ConditionalFieldConverter(sdkField1);
     sdkField2 = converter.ToSDKConditionalField();
     Assert.IsNotNull(sdkField2);
     Assert.AreEqual(sdkField2, sdkField1);
 }
        public void ConvertSDKToAPI()
        {
            sdkField1 = CreateTypicalSDKConditionalField();
            apiField1 = new ConditionalFieldConverter(sdkField1).ToAPIConditionalField();

            Assert.IsNotNull(apiField1);
            Assert.AreEqual(sdkField1.Value, apiField1.Value);
            Assert.AreEqual(sdkField1.X, apiField1.Left);
            Assert.AreEqual(sdkField1.Y, apiField1.Top);
            Assert.AreEqual(sdkField1.Width, apiField1.Width);
            Assert.AreEqual(sdkField1.Height, apiField1.Height);
            Assert.AreEqual(sdkField1.Id, apiField1.Id);
            Assert.AreEqual(sdkField1.Name, apiField1.Name);
            Assert.AreEqual(sdkField1.Page, apiField1.Page);
            Assert.AreEqual(sdkField1.Conditions.Count, apiField1.Conditions.Count);
        }
        public void ConvertAPIToSDK()
        {
            apiField1 = CreateTypicalAPIConditionalField();
            sdkField1 = new ConditionalFieldConverter(apiField1).ToSDKConditionalField();

            Assert.IsNotNull(sdkField1);
            Assert.AreEqual(sdkField1.Validator, new FieldValidatorConverter(apiField1.Validation).ToSDKFieldValidator());
            Assert.AreEqual(sdkField1.Id, apiField1.Id);
            Assert.AreEqual(sdkField1.Name, apiField1.Name);
            Assert.AreEqual(sdkField1.Page, apiField1.Page);
            Assert.AreEqual(sdkField1.Style, new FieldStyleAndSubTypeConverter(apiField1.Subtype, apiField1.Binding).ToSDKFieldStyle());
            Assert.AreEqual(sdkField1.TextAnchor, new TextAnchorConverter(apiField1.ExtractAnchor).ToSDKTextAnchor());
            Assert.AreEqual(sdkField1.Value, apiField1.Value);
            Assert.AreEqual(sdkField1.X, apiField1.Left);
            Assert.AreEqual(sdkField1.Y, apiField1.Top);
            Assert.AreEqual(sdkField1.Width, apiField1.Width);
            Assert.AreEqual(sdkField1.Height, apiField1.Height);
            Assert.AreEqual(sdkField1.Conditions.Count, apiField1.Conditions.Count);
        }
 public void ConvertNullSDKToSDK()
 {
     sdkField1 = null;
     converter = new ConditionalFieldConverter(sdkField1);
     Assert.IsNull(converter.ToSDKConditionalField());
 }
Beispiel #6
0
 public void ModifyConditionalField(PackageId packageId, string documentId, SignatureId signatureId, ConditionalField sdkField)
 {
     OneSpanSign.API.ConditionalField apiField = new ConditionalFieldConverter(sdkField).ToAPIConditionalField();
     apiClient.ModifyConditionalField(packageId, documentId, signatureId, apiField);
 }