예제 #1
0
        public void CreateField_EnsureValidName()
        {
            var xml   = XDocument.Parse("<field name=\"_3DES_EDE_CBC\" />");
            var field = XmlApiImporter.CreateField(xml.Root);

            Assert.AreEqual("_3desEdeCbc", field.Name);
        }
예제 #2
0
        public void CreateField_HandleDollarSignNumber()
        {
            var xml   = XDocument.Parse("<field name=\"$3\" />");
            var field = XmlApiImporter.CreateField(xml.Root);

            Assert.AreEqual("_3", field.Name);
        }
예제 #3
0
        public void CreateField_StudlyCaseName()
        {
            var xml   = XDocument.Parse("<field name=\"_DES_EDE_CBC\" />");
            var field = XmlApiImporter.CreateField(xml.Root);

            Assert.AreEqual("DesEdeCbc", field.Name);
        }
예제 #4
0
        public void CreateField_HandleDollarSign()
        {
            var klass = new TestClass("object", "MyNamespace.MyType");
            var xml   = XDocument.Parse("<field name=\"A$3\" />");
            var field = XmlApiImporter.CreateField(klass, xml.Root);

            Assert.AreEqual("A_3", field.Name);
        }
예제 #5
0
        public void CreateField_EnsureValidName()
        {
            var klass = new TestClass("object", "MyNamespace.MyType");
            var xml   = XDocument.Parse("<field name=\"_3DES_EDE_CBC\" />");
            var field = XmlApiImporter.CreateField(klass, xml.Root);

            Assert.AreEqual("_3desEdeCbc", field.Name);
        }
예제 #6
0
        public void CreateField_CorrectApiVersion()
        {
            var klass = new TestClass("object", "MyNamespace.MyType");
            var xml   = XDocument.Parse("<field name='$3' api-since='7' />");
            var field = XmlApiImporter.CreateField(klass, xml.Root);

            Assert.AreEqual(7, field.ApiAvailableSince);
        }
예제 #7
0
        public void Field()
        {
            var element = package.Element("class");
            var @class  = XmlApiImporter.CreateClass(package, element);
            var field   = XmlApiImporter.CreateField(element.Element("field"));

            Assert.IsTrue(field.Validate(options, new GenericParameterDefinitionList(), new CodeGeneratorContext()), "field.Validate failed!");

            Assert.AreEqual("Value", field.Name);
            Assert.AreEqual("value", field.JavaName);
            Assert.AreEqual("1234", field.Value);
            Assert.AreEqual("int", field.TypeName);
            Assert.IsTrue(field.IsStatic);
            Assert.IsTrue(field.IsConst);
        }