chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1067465 [2/2] - in /incubator/chemistry/dotcmis/trunk: DotCMIS/ DotCMIS/binding/ DotCMIS/binding/atompub/ DotCMIS/binding/webservices/ DotCMIS/client/ DotCMIS/data/ DotCMISUnitTest/
Date Sat, 05 Feb 2011 16:27:32 GMT
Modified: incubator/chemistry/dotcmis/trunk/DotCMIS/data/data-impl.cs
URL: http://svn.apache.org/viewvc/incubator/chemistry/dotcmis/trunk/DotCMIS/data/data-impl.cs?rev=1067465&r1=1067464&r2=1067465&view=diff
==============================================================================
--- incubator/chemistry/dotcmis/trunk/DotCMIS/data/data-impl.cs (original)
+++ incubator/chemistry/dotcmis/trunk/DotCMIS/data/data-impl.cs Sat Feb  5 16:27:31 2011
@@ -225,9 +225,9 @@ namespace DotCMIS.Data
         public string DisplayName { get; set; }
         public string QueryName { get; set; }
         public string Description { get; set; }
-        public PropertyType? PropertyType { get; set; }
-        public Cardinality? Cardinality { get; set; }
-        public Updatability? Updatability { get; set; }
+        public PropertyType PropertyType { get; set; }
+        public Cardinality Cardinality { get; set; }
+        public Updatability Updatability { get; set; }
         public bool? IsInherited { get; set; }
         public bool? IsRequired { get; set; }
         public bool? IsQueryable { get; set; }
@@ -427,7 +427,7 @@ namespace DotCMIS.Data
         }
     }
 
-    public abstract class PropertyData : ExtensionsData, IPropertyData
+    public abstract class AbstractPropertyData : ExtensionsData, IPropertyData
     {
         public string Id { get; set; }
         public string LocalName { get; set; }
@@ -438,37 +438,37 @@ namespace DotCMIS.Data
         {
             get
             {
-                if (this is PropertyBoolean)
+                if (this is IPropertyString)
                 {
-                    return ((PropertyBoolean)this).FirstValue;
+                    return ((IPropertyString)this).FirstValue;
                 }
-                else if (this is PropertyDateTime)
+                else if (this is IPropertyInteger)
                 {
-                    return ((PropertyDateTime)this).FirstValue;
+                    return ((IPropertyInteger)this).FirstValue;
                 }
-                else if (this is PropertyDecimal)
+                else if (this is IPropertyId)
                 {
-                    return ((PropertyDecimal)this).FirstValue;
+                    return ((IPropertyId)this).FirstValue;
                 }
-                else if (this is PropertyHtml)
+                else if (this is IPropertyBoolean)
                 {
-                    return ((PropertyHtml)this).FirstValue;
+                    return ((IPropertyBoolean)this).FirstValue;
                 }
-                else if (this is PropertyId)
+                else if (this is IPropertyDateTime)
                 {
-                    return ((PropertyId)this).FirstValue;
+                    return ((IPropertyDateTime)this).FirstValue;
                 }
-                else if (this is PropertyInteger)
+                else if (this is IPropertyDecimal)
                 {
-                    return ((PropertyInteger)this).FirstValue;
+                    return ((IPropertyDecimal)this).FirstValue;
                 }
-                else if (this is PropertyString)
+                else if (this is IPropertyHtml)
                 {
-                    return ((PropertyString)this).FirstValue;
+                    return ((IPropertyHtml)this).FirstValue;
                 }
-                else if (this is PropertyUri)
+                else if (this is IPropertyUri)
                 {
-                    return ((PropertyUri)this).FirstValue;
+                    return ((IPropertyUri)this).FirstValue;
                 }
 
                 return null;
@@ -481,49 +481,49 @@ namespace DotCMIS.Data
         }
     }
 
-    public class PropertyBoolean : PropertyData, IPropertyBoolean
+    public class PropertyBoolean : AbstractPropertyData, IPropertyBoolean
     {
         public IList<bool> Values { get; set; }
         public bool? FirstValue { get { return Values == null || Values.Count < 1 ? null
: (bool?)Values[0]; } }
     }
 
-    public class PropertyDateTime : PropertyData, IPropertyDateTime
+    public class PropertyDateTime : AbstractPropertyData, IPropertyDateTime
     {
         public IList<DateTime> Values { get; set; }
         public DateTime? FirstValue { get { return Values == null || Values.Count < 1
? null : (DateTime?)Values[0]; } }
     }
 
-    public class PropertyDecimal : PropertyData, IPropertyDecimal
+    public class PropertyDecimal : AbstractPropertyData, IPropertyDecimal
     {
         public IList<decimal> Values { get; set; }
         public decimal? FirstValue { get { return Values == null || Values.Count < 1 ?
null : (decimal?)Values[0]; } }
     }
 
-    public class PropertyHtml : PropertyData, IPropertyHtml
+    public class PropertyHtml : AbstractPropertyData, IPropertyHtml
     {
         public IList<string> Values { get; set; }
         public string FirstValue { get { return Values == null || Values.Count < 1 ? null
: Values[0]; } }
     }
 
-    public class PropertyId : PropertyData, IPropertyId
+    public class PropertyId : AbstractPropertyData, IPropertyId
     {
         public IList<string> Values { get; set; }
         public string FirstValue { get { return Values == null || Values.Count < 1 ? null
: Values[0]; } }
     }
 
-    public class PropertyInteger : PropertyData, IPropertyInteger
+    public class PropertyInteger : AbstractPropertyData, IPropertyInteger
     {
         public IList<long> Values { get; set; }
         public long? FirstValue { get { return Values == null || Values.Count < 1 ? null
: (long?)Values[0]; } }
     }
 
-    public class PropertyString : PropertyData, IPropertyString
+    public class PropertyString : AbstractPropertyData, IPropertyString
     {
         public IList<string> Values { get; set; }
         public string FirstValue { get { return Values == null || Values.Count < 1 ? null
: Values[0]; } }
     }
 
-    public class PropertyUri : PropertyData, IPropertyUri
+    public class PropertyUri : AbstractPropertyData, IPropertyUri
     {
         public IList<string> Values { get; set; }
         public string FirstValue { get { return Values == null || Values.Count < 1 ? null
: Values[0]; } }

Modified: incubator/chemistry/dotcmis/trunk/DotCMIS/data/data-intf.cs
URL: http://svn.apache.org/viewvc/incubator/chemistry/dotcmis/trunk/DotCMIS/data/data-intf.cs?rev=1067465&r1=1067464&r2=1067465&view=diff
==============================================================================
--- incubator/chemistry/dotcmis/trunk/DotCMIS/data/data-intf.cs (original)
+++ incubator/chemistry/dotcmis/trunk/DotCMIS/data/data-intf.cs Sat Feb  5 16:27:31 2011
@@ -145,9 +145,9 @@ namespace DotCMIS.Data
         string DisplayName { get; }
         string QueryName { get; }
         string Description { get; }
-        PropertyType? PropertyType { get; }
-        Cardinality? Cardinality { get; }
-        Updatability? Updatability { get; }
+        PropertyType PropertyType { get; }
+        Cardinality Cardinality { get; }
+        Updatability Updatability { get; }
         bool? IsInherited { get; }
         bool? IsRequired { get; }
         bool? IsQueryable { get; }

Modified: incubator/chemistry/dotcmis/trunk/DotCMISUnitTest/TestFramework.cs
URL: http://svn.apache.org/viewvc/incubator/chemistry/dotcmis/trunk/DotCMISUnitTest/TestFramework.cs?rev=1067465&r1=1067464&r2=1067465&view=diff
==============================================================================
--- incubator/chemistry/dotcmis/trunk/DotCMISUnitTest/TestFramework.cs (original)
+++ incubator/chemistry/dotcmis/trunk/DotCMISUnitTest/TestFramework.cs Sat Feb  5 16:27:31
2011
@@ -334,6 +334,8 @@ namespace DotCMISUnitTest
             Assert.NotNull(expected);
             Assert.NotNull(actual);
 
+            Assert.NotNull(actual.Id);
+
             Assert.AreEqual(expected.Id, actual.Id);
             Assert.AreEqual(expected.IsBaseType, actual.IsBaseType);
             Assert.AreEqual(expected.BaseTypeId, actual.BaseTypeId);
@@ -343,6 +345,39 @@ namespace DotCMISUnitTest
             Assert.AreEqual(expected.LocalNamespace, actual.LocalNamespace);
             Assert.AreEqual(expected.QueryName, actual.QueryName);
             Assert.AreEqual(expected.PropertyDefintions.Count, actual.PropertyDefintions.Count);
+
+            foreach (IPropertyDefinition propDef in expected.PropertyDefintions)
+            {
+                Assert.NotNull(propDef);
+                Assert.NotNull(propDef.Id);
+
+                IPropertyDefinition propDef2 = actual[propDef.Id];
+
+                AssertAreEqual(propDef, propDef2);
+            }
+        }
+
+        public void AssertAreEqual(IPropertyDefinition expected, IPropertyDefinition actual)
+        {
+            if (expected == null && actual == null)
+            {
+                return;
+            }
+
+            Assert.NotNull(expected);
+            Assert.NotNull(actual);
+
+            Assert.NotNull(actual.Id);
+
+            Assert.AreEqual(expected.Id, actual.Id);
+            Assert.AreEqual(expected.LocalName, actual.LocalName);
+            Assert.AreEqual(expected.LocalNamespace, actual.LocalNamespace);
+            Assert.AreEqual(expected.DisplayName, actual.DisplayName);
+            Assert.AreEqual(expected.Description, actual.Description);
+            Assert.AreEqual(expected.QueryName, actual.QueryName);
+            Assert.AreEqual(expected.PropertyType, actual.PropertyType);
+            Assert.AreEqual(expected.Cardinality, actual.Cardinality);
+            Assert.AreEqual(expected.Updatability, actual.Updatability);
         }
     }
 }



Mime
View raw message