public void SysConnectorConnectInvalidProviderTest() { //change the provider information to an invalid type _connectionProperties.Remove("Provider"); _connectionProperties.Add("Provider", InvalidPropertyValue); //call the connect method from the connector and pass in the connection properties dictionary _sysConnector.Connect(_connectionProperties); }
public void SysConnectorConnectionValidTest() { //create a new instance of the sample connector var sysConnector = new SYSConnector(); //call the connect method from the connector and pass in the connection properties dictionary sysConnector.Connect(_connectionProperties); //do a check that the IsConnected flag is true ad the connection has been opened Assert.IsTrue(sysConnector.IsConnected); }
public void SysConnectorDisconnectValidTest() { //create a new instance of the sample connector var sysConnector = new SYSConnector(); //call the connect method from the connector and pass in the connection properties dictionary sysConnector.Connect(_connectionProperties); //do a check that the IsConnected flag is true Assert.IsTrue(sysConnector.IsConnected); //call the disconnect method from the connector sysConnector.Disconnect(); //do a check the connector IsConnected flag is false Assert.IsFalse(sysConnector.IsConnected); }
public void BasicQueryValidTest() { string objectName = "Addresses"; //Create a basic root query entity, //Set the name property and the object definition full name property //Note: 'Name' property is unique and is set by the user // 'ObjectDefinitionFullName' property will be the name of the table referenced var rootEntity = new QueryEntity(); rootEntity.Name = objectName; rootEntity.ObjectDefinitionFullName = objectName; //Create a list of properties for the root entity, not these are column names rootEntity.PropertyList.Add("RecordId"); rootEntity.PropertyList.Add("ContactName"); rootEntity.PropertyList.Add("Phone"); rootEntity.PropertyList.Add("AddressType"); //create a new query object Query query = new Query(); //indicate whether or not this is a test query query.IsTestQuery = true; //set the root entity query.RootEntity = rootEntity; //Create a new instance of the Connector _sysConnector = new SYSConnector(); //Establish a connection to the data source _sysConnector.Connect(_connectionProperties); var queryResults = _sysConnector.ExecuteQuery(query); //force a check of the query results foreach (var queryResult in queryResults) { break; } //validate that results have been returned Assert.IsNotNull(queryResults); Assert.AreNotEqual(0, queryResults.Count()); //validate that data has been returned Assert.AreNotEqual(0, queryResults.ElementAt(0).Properties.Count); }
public void StartUp() { //setup the initial parameters for data connection _connectionProperties.Add("Provider", "SQLNCLI10"); _connectionProperties.Add("Server", "localhost"); _connectionProperties.Add("Database", "ScribeSampleRSSource"); _connectionProperties.Add("UserName", "sa"); //encrypt the connection password using the shared key string encryptedPassword = Encryptor.Encrypt_AesManaged("sa", CryptoKey); _connectionProperties.Add("Password", encryptedPassword); _sysConnector = new SYSConnector(); _sysConnector.Connect(_connectionProperties); }