public void It_Should_Serialise_To_This()
        {
            Discriminator dis = new DiscriminatorImpl();

            string outputXML = new EntitySetSerialisationScheme().SerialiseDiscriminator(dis);
            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(BasicDiscriminatorXml));
        }
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = FullReferenceXml;

            Reference reference = GetReference();

            string outputXML = new EntitySetSerialisationScheme().SerialiseReference(reference);
            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = BasicKeyXml;

            EntityKey key = new EntityKeyImpl();

            string outputXML = new EntitySetSerialisationScheme().SerialiseKey(key);
            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = BasicPropertyXml;

            ComponentProperty property = new ComponentPropertyImpl("Street");

            string outputXML = new EntitySetSerialisationScheme().SerialiseComponentProperty(property);
            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
Beispiel #5
0
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = BasicEntityXml;

            Entity entity = GetEntity();

            string outputXML = new EntitySetSerialisationScheme().SerialiseEntity(entity);

            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = BasicComponentXml;

            var component = new ComponentImpl();
            component.ParentEntity = new EntityImpl("Entity1");
            component.Name = "HomeAddress";

            string outputXML = new EntitySetSerialisationScheme().SerialiseComponent(component);
            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = FullEntitySetXml;

            EntitySet entitySet = new EntitySetImpl();
            entitySet.AddEntity(When_Serialising_An_Empty_Entity.GetEntity());
            entitySet.AddReference(When_Serialising_An_Reference_With_All_Fields_Set.GetReference());

            string outputXML = new EntitySetSerialisationScheme().SerialiseEntitySet(entitySet);
            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = BasicSpecXml;

            var spec = new ComponentSpecificationImpl();
            spec.Name = "Address";
            spec.AddProperty(new ComponentPropertyImpl("Street"));
            spec.CreateImplementedComponentFor(new EntityImpl("Entity1"), "HomeAddress");

            string outputXML = new EntitySetSerialisationScheme().SerialiseComponentSpecification(spec);
            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = FullKeyXml;

            EntityKey key = new EntityKeyImpl();
            key.AddProperty(new PropertyImpl { Name = "Property1" });
            key.Component = new ComponentImpl { Name = "Component_Name" };
            key.KeyType = EntityKeyType.Component;

            string outputXML = new EntitySetSerialisationScheme().SerialiseKey(key);
            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = FullEntityXml;

            Entity entity = new EntityImpl("Entity1");
            entity.AddProperty(new PropertyImpl());
            Entity entity2 = new EntityImpl("Entity2");
            entity2.AddChild(entity);

            string outputXML = new EntitySetSerialisationScheme().SerialiseEntity(entity);
            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public void It_Should_Serialise_To_This()
        {
            Table table = new Table("Table1");
            Column column = new Column("Column1");
            table.AddColumn(column);

            var dis = new DiscriminatorBuilder()
                .SingleConditionDiscriminator(column, Operator.Equal, new ExpressionValueImpl("5"));

            string outputXML = new EntitySetSerialisationScheme().SerialiseDiscriminator(dis);
            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(FullDiscriminatorXml));
        }
Beispiel #12
0
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = FullEntitySetXml;

            EntitySet entitySet = new EntitySetImpl();

            entitySet.AddEntity(When_Serialising_An_Empty_Entity.GetEntity());
            entitySet.AddReference(When_Serialising_An_Reference_With_All_Fields_Set.GetReference());

            string outputXML = new EntitySetSerialisationScheme().SerialiseEntitySet(entitySet);

            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = BasicComponentXml;

            var component = new ComponentImpl();

            component.ParentEntity = new EntityImpl("Entity1");
            component.Name         = "HomeAddress";

            string outputXML = new EntitySetSerialisationScheme().SerialiseComponent(component);

            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public void It_Should_Serialise_To_This()
        {
            Table  table  = new Table("Table1");
            Column column = new Column("Column1");

            table.AddColumn(column);

            var dis = new DiscriminatorBuilder()
                      .SingleConditionDiscriminator(column, Operator.Equal, new ExpressionValueImpl("5"));

            string outputXML = new EntitySetSerialisationScheme().SerialiseDiscriminator(dis);

            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(FullDiscriminatorXml));
        }
Beispiel #15
0
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = FullKeyXml;

            EntityKey key = new EntityKeyImpl();

            key.Component = new ComponentImpl {
                Name = "Component_Name"
            };

            string outputXML = new EntitySetSerialisationScheme().SerialiseKey(key);

            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = BasicSpecXml;

            var spec = new ComponentSpecificationImpl();

            spec.Name = "Address";
            spec.AddProperty(new ComponentPropertyImpl("Street"));
            spec.CreateImplementedComponentFor(new EntityImpl("Entity1"), "HomeAddress");

            string outputXML = new EntitySetSerialisationScheme().SerialiseComponentSpecification(spec);

            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
Beispiel #17
0
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = FullEntityXml;

            Entity entity = new EntityImpl("Entity1");

            entity.AddProperty(new PropertyImpl());
            Entity entity2 = new EntityImpl("Entity2");

            entity2.AddChild(entity);

            string outputXML = new EntitySetSerialisationScheme().SerialiseEntity(entity);

            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = FullPropertyXml;

            Property property = new PropertyImpl
                                    {
                                        Name = "Property1",
                                        ReadOnly = true,
                                        Type = "SomeType",
                                        //IsVirtual = true,
                                        IsKeyProperty = true
                                    };

            string outputXML = new EntitySetSerialisationScheme().SerialiseProperty(property);
            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public void It_Should_Serialise_To_This()
        {
            const string expectedXML = FullPropertyXml;

            Property property = new PropertyImpl
            {
                Name     = "Property1",
                ReadOnly = true,
                Type     = "SomeType",
                //IsVirtual = true,
                IsKeyProperty = true
            };

            string outputXML = new EntitySetSerialisationScheme().SerialiseProperty(property);

            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public override void Save(string folder)
        {
            string xmlHeader = "<?xml version=\"1.0\" ?>" + Environment.NewLine;

            if (editModelScreen != null)
            {
                editModelScreen.Save();
            }

            string xml = new DatabaseSerialisationScheme().Serialise(MappingSet.Database);

            File.WriteAllText(Path.Combine(folder, DatabaseFilename), xmlHeader + xml);

            xml = new EntitySetSerialisationScheme().SerialiseEntitySet(MappingSet.EntitySet);
            File.WriteAllText(Path.Combine(folder, EntitiesFilename), xmlHeader + xml);

            xml = new MappingSetSerialisationScheme().SerialiseMappingSet(MappingSet);
            File.WriteAllText(Path.Combine(folder, MappingsFilename), xmlHeader + xml);
        }
Beispiel #21
0
        public void A_ToCardinality__It_Should_Default_To_One()
        {
            string expectedXML = string.Format(CardinalityFormatXml, 1, 1, 2, 2);

            Reference reference = new ReferenceImpl(new Guid("11111111-1111-1111-1111-111111111111"))
            {
                Entity2      = new EntityImpl("Entity1"),
                Entity1      = new EntityImpl("Entity2"),
                Cardinality2 = new Cardinality(2),
                End1Enabled  = true,
                End2Enabled  = true,
                End1Name     = "ParentEntity1",
                End2Name     = "Entity2s"
            };

            string outputXML = new EntitySetSerialisationScheme().SerialiseReference(reference);

            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
        public void A_FromCardinality__It_Should_Default_To_One()
        {
            string expectedXML = string.Format(CardinalityFormatXml, 3, 4, 1, 1);

            Reference reference = new ReferenceImpl (new Guid("11111111-1111-1111-1111-111111111111"))
                                  	{
                                  		Entity2 = new EntityImpl("Entity1"),
                                  		Entity1 = new EntityImpl("Entity2"),
                                  		Cardinality1 = new Cardinality(3, 4),
                                        End1Enabled = true,
                                        End2Enabled = true,
                                        End1Name = "ParentEntity1",
                                        End2Name = "Entity2s"
                                  	};

            string outputXML = new EntitySetSerialisationScheme().SerialiseReference(reference);
            outputXML = XmlSqueezer.RemoveWhitespaceBetweenElements(outputXML);
            Assert.That(outputXML, Is.EqualTo(expectedXML));
        }
Beispiel #23
0
        public override void Save(string folder)
        {
            string xmlHeader = "<?xml version=\"1.0\" ?>" + Environment.NewLine;

            if (editModelScreen != null)
                editModelScreen.Save();

            string xml = new DatabaseSerialisationScheme().Serialise(MappingSet.Database);
            File.WriteAllText(Path.Combine(folder, DatabaseFilename), xmlHeader + xml);

            xml = new EntitySetSerialisationScheme().SerialiseEntitySet(MappingSet.EntitySet);
            File.WriteAllText(Path.Combine(folder, EntitiesFilename), xmlHeader + xml);

            xml = new MappingSetSerialisationScheme().SerialiseMappingSet(MappingSet);
            File.WriteAllText(Path.Combine(folder, MappingsFilename), xmlHeader + xml);
        }