示例#1
0
        public void NoTablesTest()
        {
            var rs = new ReplicationSet
            {
                Name   = "Test",
                Source = new DatabaseInfo {
                    Name = "Source", ConnectionString = GetConnectionString(SourceDatabaseName)
                },
                Destinations = { new DatabaseInfo {
                                     Name = "Destination", ConnectionString = GetConnectionString(DestinationDatabaseName)
                                 } },
                Tables = new List <string> {
                    "Test"
                }
            };
            var config = new Config {
                ReplicationSets = { rs }
            };

            var synchronizer = new Synchronizer(config)
            {
                Timeout = 1000
            };
            var success = synchronizer.Sync();

            Assert.That(success, Is.True);
        }
示例#2
0
        public void FalseSourceTest()
        {
            var rs = new ReplicationSet
            {
                Name   = "Test",
                Source = new DatabaseInfo {
                    Name = "Source", ConnectionString = GetConnectionString("Error")
                },
                Destinations = { new DatabaseInfo {
                                     Name = "Destination", ConnectionString = GetConnectionString(DestinationDatabaseName)
                                 } },
                Tables = { }
            };
            var config = new Config {
                ReplicationSets = { rs }
            };

            var synchronizer = new Synchronizer(config);

            synchronizer.Timeout = 1000;
            Assert.Throws <System.Data.SqlClient.SqlException>(() => synchronizer.Sync());
        }