Exemple #1
0
        public void Setup()
        {
            UnitTestStartAndEnd.Start(DatabaseName);

            var customObject = new CustomObject()
            {
                IntegerField = 42,
                StringField  = "The answer to everything..."
            };

            var customXml     = string.Empty;
            var stringBuilder = new StringBuilder();

            using (var writer = XmlWriter.Create(stringBuilder, new XmlWriterSettings()
            {
                OmitXmlDeclaration = true
            }))
            {
                XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
                ns.Add(string.Empty, string.Empty);
                new XmlSerializer(typeof(CustomObject)).Serialize(writer, customObject, ns);
                customXml = stringBuilder.ToString();
            }

            ExecuteNonQuery("CREATE Table TestObject (id int not null, name varchar(250), location geography, customData xml)");
            ExecuteNonQuery("INSERT INTO TestObject (id, name, location, customData) values(1, 'One', geography::STGeomFromText('Point(-122.360 47.656)', 4326), '" + customXml + "')");
            ExecuteNonQuery("INSERT INTO TestObject (id, name, location, customData) values(2, 'Two', geography::STGeomFromText('Point(-122.360 47.656)', 4326), '" + customXml + "')");
            ExecuteNonQuery("INSERT INTO TestObject (id, name, location, customData) values(3, 'Three', geography::STGeomFromText('Point(-122.360 47.656)', 4326), '" + customXml + "')");
            ExecuteNonQuery("INSERT INTO TestObject (id, name, location, customData) values(4, 'Four', geography::STGeomFromText('Point(-122.360 47.656)', 4326), '" + customXml + "')");
            ExecuteNonQuery("INSERT INTO TestObject (id, name, location, customData) values(5, 'Five', geography::STGeomFromText('Point(-122.360 47.656)', 4326), '" + customXml + "')");
        }
Exemple #2
0
 public void TearDown()
 {
     UnitTestStartAndEnd.End(DatabaseName);
 }