public void ConvertSDKToAPI()
        {
            FieldStyle fieldStyle   = FieldStyle.UNBOUND_CUSTOM_FIELD;
            string     fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();

            Assert.AreEqual(fieldSubtype, FieldStyle.UNBOUND_CUSTOM_FIELD.getApiValue());

            fieldStyle   = FieldStyle.UNBOUND_TEXT_FIELD;
            fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();
            Assert.AreEqual(fieldSubtype, FieldStyle.UNBOUND_TEXT_FIELD.getApiValue());

            fieldStyle   = FieldStyle.LABEL;
            fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();
            Assert.AreEqual(fieldSubtype, FieldStyle.LABEL.getApiValue());

            fieldStyle   = FieldStyle.UNBOUND_CHECK_BOX;
            fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();
            Assert.AreEqual(fieldSubtype, FieldStyle.UNBOUND_CHECK_BOX.getApiValue());

            fieldStyle   = FieldStyle.UNBOUND_RADIO_BUTTON;
            fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();
            Assert.AreEqual(fieldSubtype, FieldStyle.UNBOUND_RADIO_BUTTON.getApiValue());

            fieldStyle   = FieldStyle.DROP_LIST;
            fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();
            Assert.AreEqual(fieldSubtype, FieldStyle.DROP_LIST.getApiValue());

            fieldStyle   = FieldStyle.TEXT_AREA;
            fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();
            Assert.AreEqual(fieldSubtype, FieldStyle.TEXT_AREA.getApiValue());

            fieldStyle   = FieldStyle.BOUND_QRCODE;
            fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();
            Assert.AreEqual(fieldSubtype, FieldStyle.BOUND_QRCODE.getApiValue());

            fieldStyle   = FieldStyle.SEAL;
            fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();
            Assert.AreEqual(fieldSubtype, FieldStyle.SEAL.getApiValue());

            fieldStyle   = FieldStyle.BOUND_DATE;
            fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();
            Assert.AreEqual(fieldSubtype, FieldStyle.LABEL.getApiValue());

            fieldStyle   = FieldStyle.BOUND_NAME;
            fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();
            Assert.AreEqual(fieldSubtype, FieldStyle.LABEL.getApiValue());

            fieldStyle   = FieldStyle.BOUND_TITLE;
            fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();
            Assert.AreEqual(fieldSubtype, FieldStyle.LABEL.getApiValue());

            fieldStyle   = FieldStyle.BOUND_COMPANY;
            fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();
            Assert.AreEqual(fieldSubtype, FieldStyle.LABEL.getApiValue());

            fieldStyle   = FieldStyle.valueOf("unknownvalue");
            fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();
            Assert.AreEqual("unknownvalue", fieldSubtype);
        }
Пример #2
0
        public void whenBuildingBindingStringForAnyUnkownFieldStyleThenNULLIsReturned()
        {
            string expectedBinding = null;


            string actualBinding = FieldStyleUtility.Binding(FieldStyle.valueOf("ThisFieldStyleDoesNotExistInSDK"));


            Assert.AreEqual(expectedBinding, actualBinding);
        }
Пример #3
0
        public void whenBuildingFieldStyleWithAPIValueTEXTFIELDThenUNBOUND_TEXT_FIELDFieldStyleIsReturned()
        {
            string expectedSDKValue = "UNBOUND_TEXT_FIELD";


            FieldStyle classUnderTest = FieldStyle.valueOf("TEXTFIELD");
            string     actualSDKValue = classUnderTest.getSdkValue();


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
Пример #4
0
        public void whenBuildingFieldStyleWithAPIValueQRCODEThenBOUND_QRCODEFieldStyleIsReturned()
        {
            string expectedSDKValue = "BOUND_QRCODE";


            FieldStyle classUnderTest = FieldStyle.valueOf("QRCODE");
            string     actualSDKValue = classUnderTest.getSdkValue();


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
Пример #5
0
        public void whenBuildingFieldStyleWithUnknownAPIValueThenUNRECOGNIZEDFieldStyleIsReturned()
        {
            string expectedSDKValue = "UNRECOGNIZED";


            FieldStyle classUnderTest = FieldStyle.valueOf("ThisFieldStyleDoesNotExistInSDK");
            String     actualSDKValue = classUnderTest.getSdkValue();


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
Пример #6
0
        public void whenBuildingFieldStyleWithAPIValueSEALThenSEALFieldStyleIsReturned()
        {
            string expectedSDKValue = "SEAL";


            FieldStyle classUnderTest = FieldStyle.valueOf("SEAL");
            string     actualSDKValue = classUnderTest.getSdkValue();


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
Пример #7
0
        public void whenBuildingFieldStyleWithAPIValueLISTThenDROP_LISTFieldStyleIsReturned()
        {
            string expectedSDKValue = "DROP_LIST";


            FieldStyle classUnderTest = FieldStyle.valueOf("LIST");
            string     actualSDKValue = classUnderTest.getSdkValue();


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
Пример #8
0
        public void whenBuildingFieldStyleWithAPIValueTEXT_AREAThenTEXT_AREAFieldStyleIsReturned()
        {
            string expectedSDKValue = "TEXT_AREA";


            FieldStyle classUnderTest = FieldStyle.valueOf("TEXTAREA");
            string     actualSDKValue = classUnderTest.getSdkValue();


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
Пример #9
0
        public void whenBuildingFieldStyleWithAPIValueRADIOThenUNBOUND_RADIO_BUTTONFieldStyleIsReturned()
        {
            string expectedSDKValue = "UNBOUND_RADIO_BUTTON";


            FieldStyle classUnderTest = FieldStyle.valueOf("RADIO");
            string     actualSDKValue = classUnderTest.getSdkValue();


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
Пример #10
0
        public void whenBuildingFieldStyleWithAPIValueCHECKBOXThenUNBOUND_CHECK_BOXFieldStyleIsReturned()
        {
            string expectedSDKValue = "UNBOUND_CHECK_BOX";


            FieldStyle classUnderTest = FieldStyle.valueOf("CHECKBOX");
            string     actualSDKValue = classUnderTest.getSdkValue();


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
        public void ConvertAPIToSDK()
        {
            string BINDING_DATE    = "{approval.signed}";
            string BINDING_TITLE   = "{signer.title}";
            string BINDING_NAME    = "{signer.name}";
            string BINDING_COMPANY = "{signer.company}";

            // Where the conversion is based on subtype.
            string     binding;
            string     fieldSubtype;
            FieldStyle fieldStyle;

            fieldSubtype = FieldStyle.UNBOUND_CUSTOM_FIELD.getApiValue();
            binding      = null;
            fieldStyle   = new FieldStyleAndSubTypeConverter(fieldSubtype, binding).ToSDKFieldStyle();
            Assert.AreEqual(fieldStyle, FieldStyle.UNBOUND_CUSTOM_FIELD);

            fieldSubtype = FieldStyle.UNBOUND_TEXT_FIELD.getApiValue();
            binding      = null;
            fieldStyle   = new FieldStyleAndSubTypeConverter(fieldSubtype, binding).ToSDKFieldStyle();
            Assert.AreEqual(fieldStyle, FieldStyle.UNBOUND_TEXT_FIELD);

            fieldSubtype = FieldStyle.UNBOUND_CHECK_BOX.getApiValue();
            binding      = null;
            fieldStyle   = new FieldStyleAndSubTypeConverter(fieldSubtype, binding).ToSDKFieldStyle();
            Assert.AreEqual(fieldStyle, FieldStyle.UNBOUND_CHECK_BOX);

            fieldSubtype = FieldStyle.UNBOUND_RADIO_BUTTON.getApiValue();
            binding      = null;
            fieldStyle   = new FieldStyleAndSubTypeConverter(fieldSubtype, binding).ToSDKFieldStyle();
            Assert.AreEqual(fieldStyle, FieldStyle.UNBOUND_RADIO_BUTTON);

            fieldSubtype = FieldStyle.TEXT_AREA.getApiValue();
            binding      = null;
            fieldStyle   = new FieldStyleAndSubTypeConverter(fieldSubtype, binding).ToSDKFieldStyle();
            Assert.AreEqual(fieldStyle, FieldStyle.TEXT_AREA);

            fieldSubtype = FieldStyle.DROP_LIST.getApiValue();
            binding      = null;
            fieldStyle   = new FieldStyleAndSubTypeConverter(fieldSubtype, binding).ToSDKFieldStyle();
            Assert.AreEqual(fieldStyle, FieldStyle.DROP_LIST);

            fieldSubtype = FieldStyle.BOUND_QRCODE.getApiValue();
            binding      = null;
            fieldStyle   = new FieldStyleAndSubTypeConverter(fieldSubtype, binding).ToSDKFieldStyle();
            Assert.AreEqual(fieldStyle, FieldStyle.BOUND_QRCODE);

            fieldSubtype = FieldStyle.SEAL.getApiValue();
            binding      = null;
            fieldStyle   = new FieldStyleAndSubTypeConverter(fieldSubtype, binding).ToSDKFieldStyle();
            Assert.AreEqual(fieldStyle, FieldStyle.SEAL);

            fieldSubtype = "THIS_IS_A_NEW_FIELD_ADDED";
            binding      = null;
            fieldStyle   = new FieldStyleAndSubTypeConverter(fieldSubtype, binding).ToSDKFieldStyle();
            Assert.AreEqual(fieldStyle.getApiValue(), "THIS_IS_A_NEW_FIELD_ADDED");

            // Where the conversion is based on binding.
            fieldSubtype = "";
            binding      = BINDING_DATE;
            fieldStyle   = new FieldStyleAndSubTypeConverter(fieldSubtype, binding).ToSDKFieldStyle();
            Assert.AreEqual(fieldStyle, FieldStyle.BOUND_DATE);

            fieldSubtype = "";
            binding      = BINDING_TITLE;
            fieldStyle   = new FieldStyleAndSubTypeConverter(fieldSubtype, binding).ToSDKFieldStyle();
            Assert.AreEqual(fieldStyle, FieldStyle.BOUND_TITLE);

            fieldSubtype = "";
            binding      = BINDING_NAME;
            fieldStyle   = new FieldStyleAndSubTypeConverter(fieldSubtype, binding).ToSDKFieldStyle();
            Assert.AreEqual(fieldStyle, FieldStyle.BOUND_NAME);

            fieldSubtype = "";
            binding      = BINDING_COMPANY;
            fieldStyle   = new FieldStyleAndSubTypeConverter(fieldSubtype, binding).ToSDKFieldStyle();
            Assert.AreEqual(fieldStyle, FieldStyle.BOUND_COMPANY);

            fieldSubtype = "";
            binding      = "";
            fieldStyle   = new FieldStyleAndSubTypeConverter(fieldSubtype, binding).ToSDKFieldStyle();
            Assert.AreEqual(fieldStyle.getApiValue(), FieldStyle.valueOf("").getApiValue());
        }