예제 #1
0
        public void CopyWithNameAndCategoryPath_Fail()
        {
            var tableName    = RandomUtility.NextIdentifier();
            var categoryPath = RandomUtility.NextCategoryPath();

            this.table.Copy(tableName, categoryPath);
        }
예제 #2
0
        public void NewWithNullNameAndType()
        {
            var categoryPath = RandomUtility.NextCategoryPath();
            var type         = new CremaDataType(null, categoryPath);

            Assert.AreEqual(string.Empty, type.TypeName);
            Assert.AreEqual(categoryPath, type.CategoryPath);
            Assert.AreEqual(CremaSchema.TypeNamespace + type.CategoryPath + type.TypeName, type.Namespace);
        }
예제 #3
0
        public void CreateWithNameAndCategoryPath()
        {
            var dataTable = new CremaDataTable(RandomUtility.NextIdentifier(), RandomUtility.NextCategoryPath(1));

            Assert.AreNotEqual(string.Empty, dataTable.Name);
            Assert.AreNotEqual(string.Empty, dataTable.TableName);
            Assert.AreEqual(string.Empty, dataTable.TemplateNamespace);
            Assert.AreNotEqual(PathUtility.Separator, dataTable.CategoryPath);
            Assert.AreEqual(CremaSchema.TableNamespace + dataTable.CategoryPath + dataTable.TableName, dataTable.Namespace);
        }
예제 #4
0
        public void NewWithNameAndCategoryPath()
        {
            var typeName     = RandomUtility.NextIdentifier();
            var categoryPath = RandomUtility.NextCategoryPath();
            var type         = new CremaDataType(typeName, categoryPath);

            Assert.AreEqual(typeName, type.TypeName);
            Assert.AreEqual(categoryPath, type.CategoryPath);
            Assert.AreEqual(CremaSchema.TypeNamespace + type.CategoryPath + type.TypeName, type.Namespace);
        }
예제 #5
0
        public void Change_CategoryTest()
        {
            var dataSet      = CremaDataSetExtensions.CreateRandomSet();
            var dataTable1   = dataSet.Tables.Random(item => item.TemplatedParent == null && item.Parent == null);
            var modification = dataTable1.ModificationInfo;

            Thread.Sleep(1000);
            dataTable1.CategoryPath = RandomUtility.NextCategoryPath();

            Assert.AreEqual(modification, dataTable1.ModificationInfo);
        }
예제 #6
0
        public void SetCategoryPath()
        {
            var categoryPath     = RandomUtility.NextCategoryPath(3);
            var modificationInfo = this.table.ModificationInfo;

            Thread.Sleep(1000);
            this.table.CategoryPath = categoryPath;
            Assert.AreEqual(string.Empty, this.table.TableName);
            Assert.AreEqual(categoryPath, this.table.CategoryPath);
            Assert.AreEqual(modificationInfo.DateTime, this.table.ModificationInfo.DateTime);
        }
예제 #7
0
        public void SetNameAndCategoryPath()
        {
            var tableName    = RandomUtility.NextIdentifier();
            var categoryPath = RandomUtility.NextCategoryPath();

            this.table.TableName    = tableName;
            this.table.CategoryPath = categoryPath;
            Assert.AreEqual(tableName, this.table.TableName);
            Assert.AreEqual(categoryPath, this.table.CategoryPath);
            Assert.AreEqual(CremaSchema.TableNamespace + categoryPath + tableName, table.Namespace);
        }
예제 #8
0
        private void InitializeRandom(bool child)
        {
            var tableName    = RandomUtility.NextIdentifier();
            var categoryPath = RandomUtility.NextCategoryPath();

            this.table.TableName    = tableName;
            this.table.CategoryPath = categoryPath;
            this.table.AddRandomColumns(10);
            this.table.AddRandomRows(10);
            if (child == true)
            {
                this.table.AddRandomChilds(10);
            }
        }
        public void ItemNameTest()
        {
            var dataSet1  = new CremaDataSet();
            var dataType1 = dataSet1.AddRandomType();

            var dataSet2     = new CremaDataSet();
            var typeName     = RandomUtility.NextIdentifier();
            var categoryPath = RandomUtility.NextCategoryPath();

            dataSet2.ReadTypeString(dataType1.GetXmlSchema(), new ItemName(categoryPath, typeName));

            var dataType2 = dataSet2.Types.First();

            Assert.AreEqual(typeName, dataType2.Name);
            Assert.AreEqual(categoryPath, dataType2.CategoryPath);
        }
예제 #10
0
        public void CopyChildTable()
        {
            var dataSet      = new CremaDataSet();
            var dataTable    = dataSet.Tables.Add();
            var childTable1  = dataTable.Childs.Add();
            var derivedTable = dataTable.Inherit();

            derivedTable.CategoryPath = RandomUtility.NextCategoryPath();
            var childTable2 = childTable1.Copy();

            var derivedChild1 = derivedTable.Childs[childTable1.TableName];
            var derivedChild2 = derivedTable.Childs[childTable2.TableName];

            Assert.AreEqual(derivedTable.CategoryPath, derivedChild1.CategoryPath);
            Assert.AreEqual(derivedTable.CategoryPath, derivedChild2.CategoryPath);

            Assert.AreEqual(dataTable.Childs.Count, derivedTable.Childs.Count);

            Assert.AreEqual(childTable1.TableName, derivedChild1.TableName);
            Assert.AreEqual(childTable2.TableName, derivedChild2.TableName);

            Assert.AreEqual(childTable1.Name, derivedChild1.TemplatedParentName);
            Assert.AreEqual(childTable2.Name, derivedChild2.TemplatedParentName);
        }