Пример #1
0
        public void Outputs_Nothing()
        {
            IDatabaseConnector connector = MockRepository.GenerateStub <IDatabaseConnector>();
            string             output    = new DatabaseSerialisationScheme().SerialiseConnectionInformation(connector);

            Assert.That(output, Is.Empty);
        }
Пример #2
0
        public void Outputs_This()
        {
            ISQLCEDatabaseConnector connector = MockRepository.GenerateStub <ISQLCEDatabaseConnector>();

            connector.Filename = "database.sdf";

            string output = new DatabaseSerialisationScheme().SerialiseConnectionInformation(connector);

            Assert.That(output.RemoveWhitespaceBetweenXmlElements(), Is.EqualTo(ExpectedXml));
        }
Пример #3
0
        public void Outputs_This()
        {
            ISQLServer2005DatabaseConnector connector = MockRepository.GenerateStub <ISQLServer2005DatabaseConnector>();

            connector.ConnectionInformation = new ConnectionStringHelper
            {
                UserName     = "******",
                Password     = "******",             // Including to make sure it does not save the password
                ServerName   = "server",
                DatabaseName = "database"
            };

            string output = new DatabaseSerialisationScheme().SerialiseConnectionInformation(connector);

            Assert.That(output.RemoveWhitespaceBetweenXmlElements(), Is.EqualTo(ExpectedXml));
        }
Пример #4
0
        public void It_Should_Be_Reconstructed_Correctly()
        {
            Relationship rel = new RelationshipImpl
            {
                Name         = "Relation1",
                Identifier   = new Guid("11111111-1111-1111-1111-111111111111"),
                PrimaryTable = new Table("Table1"),
                ForeignTable = new Table("Table2"),
                PrimaryKey   = new Key("K1", DatabaseKeyType.Primary),
                ForeignKey   = new Key("ForeignKey", DatabaseKeyType.Foreign)
            };

            string output = new DatabaseSerialisationScheme().SerialiseRelationship(rel);

            output = XmlSqueezer.RemoveWhitespaceBetweenElements(output);

            Assert.That(output, Is.EqualTo(FullRelationshipXml));
        }
Пример #5
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);
        }