public void CollectionTest() { TypesTable typesTable = new TypesTable(); StandardLibraryCreator sl = new StandardLibraryCreator(); sl.CreateStandardLibrary(typesTable); Classifier integerType = typesTable.Library.Integer; Classifier realType = typesTable.Library.Real; Classifier anyType = typesTable.Library.Any; CollectionType bagInteger = typesTable.Library.CreateCollection(Exolutio.Model.OCL.CollectionKind.Bag, integerType); CollectionType bagReal = typesTable.Library.CreateCollection(Exolutio.Model.OCL.CollectionKind.Bag, realType); CollectionType setType = typesTable.Library.CreateCollection(Exolutio.Model.OCL.CollectionKind.Set, integerType); CollectionType seqType = typesTable.Library.CreateCollection(Exolutio.Model.OCL.CollectionKind.Sequence, integerType);; CollectionType ordType = typesTable.Library.CreateCollection(Exolutio.Model.OCL.CollectionKind.OrderedSet, integerType); CollectionType collInteger = typesTable.Library.CreateCollection(Exolutio.Model.OCL.CollectionKind.Collection, integerType); Assert.IsTrue(bagInteger.ConformsTo(bagReal)); Assert.IsTrue(bagInteger.ConformsTo(collInteger)); Assert.IsFalse(bagReal.ConformsTo(collInteger)); Assert.IsFalse(bagInteger.ConformsTo(seqType)); Assert.IsFalse(bagInteger.ConformsTo(setType)); Assert.IsFalse(bagInteger.ConformsTo(ordType)); Assert.IsFalse(seqType.ConformsTo(bagInteger)); Assert.IsFalse(seqType.ConformsTo(setType)); Assert.IsFalse(seqType.ConformsTo(ordType)); Assert.IsFalse(ordType.ConformsTo(bagInteger)); Assert.IsFalse(ordType.ConformsTo(setType)); Assert.IsFalse(ordType.ConformsTo(seqType)); Assert.IsFalse(setType.ConformsTo(bagInteger)); Assert.IsFalse(setType.ConformsTo(ordType)); Assert.IsFalse(setType.ConformsTo(seqType)); Assert.IsTrue(bagInteger.CollectionKind == Exolutio.Model.OCL.CollectionKind.Bag); Assert.IsTrue(collInteger.CollectionKind == Exolutio.Model.OCL.CollectionKind.Collection); Assert.IsTrue(setType.CollectionKind == Exolutio.Model.OCL.CollectionKind.Set); Assert.IsTrue(seqType.CollectionKind == Exolutio.Model.OCL.CollectionKind.Sequence); Assert.IsTrue(ordType.CollectionKind == Exolutio.Model.OCL.CollectionKind.OrderedSet); Assert.AreEqual(bagInteger.Name, "Bag(" + integerType.QualifiedName + ")"); Assert.AreEqual(collInteger.Name, "Collection(" + integerType.QualifiedName + ")"); Assert.AreEqual(setType.Name, "Set(" + integerType.QualifiedName + ")"); Assert.AreEqual(ordType.Name, "OrderedSet(" + integerType.QualifiedName + ")"); Assert.AreEqual(seqType.Name, "Sequence(" + integerType.QualifiedName + ")"); Assert.IsTrue(bagInteger == typesTable.Library.CreateCollection(Exolutio.Model.OCL.CollectionKind.Bag, integerType)); Assert.IsFalse(bagInteger == null); Assert.IsFalse(bagInteger == bagReal); Assert.IsFalse(bagInteger.Equals(null)); Assert.IsTrue(bagInteger.ConformsTo(anyType)); }