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);
        }
Example #2
0
        public void whenBuildingBindingStringForAnyUnkownFieldStyleThenNULLIsReturned()
        {
            string expectedBinding = null;


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


            Assert.AreEqual(expectedBinding, actualBinding);
        }
Example #3
0
        public void whenBuildingFieldStyleWithAPIValueCHECKBOXThenUNBOUND_CHECK_BOXFieldStyleIsReturned()
        {
            string expectedSDKValue = "UNBOUND_CHECK_BOX";


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


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
Example #4
0
        public void whenBuildingFieldStyleWithAPIValueTEXT_AREAThenTEXT_AREAFieldStyleIsReturned()
        {
            string expectedSDKValue = "TEXT_AREA";


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


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
Example #5
0
        public void whenBuildingFieldStyleWithAPIValueLISTThenDROP_LISTFieldStyleIsReturned()
        {
            string expectedSDKValue = "DROP_LIST";


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


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
Example #6
0
        public void whenBuildingFieldStyleWithUnknownAPIValueThenUNRECOGNIZEDFieldStyleIsReturned()
        {
            string expectedSDKValue = "UNRECOGNIZED";


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


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
Example #7
0
        public void whenBuildingFieldStyleWithSDKValueBOUND_COMPANYThenFieldStyleWithAPIValueLABELIsReturned()
        {
            string expectedAPIValue = "LABEL";


            FieldStyle classUnderTest = FieldStyle.BOUND_COMPANY;
            string     actualAPIValue = classUnderTest.getApiValue();


            Assert.AreEqual(expectedAPIValue, actualAPIValue);
        }
Example #8
0
        public void whenBuildingFieldStyleWithAPIValueQRCODEThenBOUND_QRCODEFieldStyleIsReturned()
        {
            string expectedSDKValue = "BOUND_QRCODE";


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


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
Example #9
0
 public void TestFieldStyle()
 {
     foreach (FieldStyle fieldStyle in FieldStyle.Values())
     {
         Assert.IsNotNull(fieldStyle.ToString());
         Assert.IsNotEmpty(fieldStyle.ToString());
     }
     Assert.AreEqual(0, (int)FieldStyle.BOUND_DATE);
     Assert.AreEqual("BOUND_NAME", (string)FieldStyle.BOUND_NAME);
     Assert.AreEqual("TEXT_AREA", FieldStyle.TEXT_AREA.GetName());
 }
Example #10
0
        public void whenBuildingFieldStyleWithAPIValueTEXTFIELDThenUNBOUND_TEXT_FIELDFieldStyleIsReturned()
        {
            string expectedSDKValue = "UNBOUND_TEXT_FIELD";


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


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
Example #11
0
        public void whenBuildingFieldStyleWithAPIValueSEALThenSEALFieldStyleIsReturned()
        {
            string expectedSDKValue = "SEAL";


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


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
Example #12
0
        public void whenBuildingFieldStyleWithAPIValueRADIOThenUNBOUND_RADIO_BUTTONFieldStyleIsReturned()
        {
            string expectedSDKValue = "UNBOUND_RADIO_BUTTON";


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


            Assert.AreEqual(expectedSDKValue, actualSDKValue);
        }
        public void ConvertSDKToAPI()
        {
            FieldStyle   fieldStyle   = FieldStyle.UNBOUND_CUSTOM_FIELD;
            FieldSubtype fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();

            Assert.AreEqual(fieldSubtype, FieldSubtype.CUSTOMFIELD);

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

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

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

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

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

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

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

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

            fieldStyle   = FieldStyle.BOUND_COMPANY;
            fieldSubtype = new FieldStyleAndSubTypeConverter(fieldStyle).ToAPIFieldSubtype();
            Assert.AreEqual(fieldSubtype, FieldSubtype.LABEL);
        }
Example #14
0
        private void AssertField(List <Field> fields, FieldStyle subtype, string binding,
                                 int top, int left, int width, int height, int pageIndex)
        {
            bool matches = false;

            foreach (Field field in fields)
            {
                if (equals(field.Binding, binding) &&
                    equals(field.Style, subtype) &&
                    AreClose(field.Y, top) &&
                    AreClose(field.X, left) &&
                    AreClose(field.Width, width) &&
                    AreClose(field.Height, height) &&
                    equals(field.Page, pageIndex))
                {
                    matches = true;
                    break;
                }
            }
            Assert.IsTrue(matches);
        }
Example #15
0
		public static string Binding(FieldStyle style)
		{
			switch (style)
			{
			case FieldStyle.BOUND_DATE:
				return BINDING_DATE;
			case FieldStyle.BOUND_NAME:
				return BINDING_NAME;
			case FieldStyle.BOUND_TITLE:
				return BINDING_TITLE;
			case FieldStyle.BOUND_COMPANY:
				return BINDING_COMPANY;
			case FieldStyle.UNBOUND_CUSTOM_FIELD:
			case FieldStyle.UNBOUND_TEXT_FIELD:
			case FieldStyle.UNBOUND_CHECK_BOX:
			case FieldStyle.LABEL:
				return null;
			default:
				throw new EslException(String.Format ("Unknown FieldStyle value {0}", style));
			}
		}
Example #16
0
		public FieldBuilder WithStyle (FieldStyle style)
		{
			this.style = style;
			return this;
		}
Example #17
0
 public FieldBuilder WithStyle(FieldStyle style)
 {
     this.style = style;
     return(this);
 }
        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());
        }
 public FieldStyleAndSubTypeConverter(FieldStyle sdkFieldStyle)
 {
     this.sdkFieldStyle = sdkFieldStyle;
     apiFieldSubType = null;
     apiFieldBinding = null;
 }
        static void SetTestStyle(ConversionProject project)
        {
            FieldStyle test = new FieldStyle ("title");
            test.Prefix = "W książce: \"";
            test.Suffix = "\"";
            test.Tags.Add (SupportedHtmlTags.b);
            project.BibTeXtoHTML_Style.HtmlExporterStyle.DefaultPositionStyle.FieldStyles.Add (test);
            project.BibTeXtoHTML_Style.HtmlExporterStyle.DefaultPositionStyle.Separator = ", ";
            project.BibTeXtoHTML_Style.HtmlExporterStyle.DefaultPositionStyle.ParagraphParameters = 
                " style=\"display:inline-table;\"";
            project.BibTeXtoHTML_Style.HtmlExporterStyle.SetHtmlHead = true;
            project.BibTeXtoHTML_Style.HtmlExporterStyle.HtmlHead = "<head>\r\n" +
                    "<meta charset=\"UTF-8\">\r\n" +
                    "<script type=\"text/x-mathjax-config\">\r\n" + 
                        "MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});\r\n" +
                    "</script>\r\n" +
                    "<script type=\"text/javascript\" async\r\n" +
                        "src=\"https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML\">" +
                    "</script>" +
                "</head>";

            project.BibTeXtoHTML_Style.BibTeXTranslator.ExecuteMath = 
                BibTeXTranslator.MathExecutionType.NoIngeretion;
            project.BibTeXtoHTML_Style.BibTeXTranslator.RemoveBracesInMathMode = false;

            project.BibTeXtoHTML_Style.ForceChanges ();
        }