예제 #1
0
 public void NewValidConnectionWorks()
 {
     var conn = new WebSqlConnection(@"localhost\sqlexpress", "junk", "", "", 5);
     var connResult = conn.connect();
     Assert.AreEqual("", connResult.message, "expect empty message on successful connect");
     Assert.AreEqual("Open", connResult.state, "expect open connection");
     Assert.AreNotEqual(ZeroGuid, connResult.connectionGuid.ToString(), "expect non-zero GUID");
 }
예제 #2
0
 public void NewInvalidConnectionReportsCorrectStatus()
 {
     var conn = new WebSqlConnection(@"localhost\sqlexpress_DOES_NOT_EXIST", "junk", "", "", 3);
     var connResult = conn.connect();
     Assert.IsTrue(connResult.message.IndexOf("error") >= 0, "expect error message on failed connect");
     Assert.AreEqual("Closed", connResult.state, "expect closed connection");
     Assert.AreEqual(ZeroGuid, connResult.connectionGuid.ToString(), "expect zero GUID");
 }
예제 #3
0
 public void NewConnectionHasPropertiesSetAsExpected()
 {
     var conn = new WebSqlConnection(@"localhost\sqlexpress","junk","","",5);
     Assert.AreEqual(36, conn.guid.ToString().Length, "expect appropriate GUID length.");
     Assert.AreEqual(ZeroGuid, conn.guid.ToString(),"expect zero GUID.");
     Assert.AreEqual(@"localhost\sqlexpress", conn.connection.DataSource, "expect correct server name");
     Assert.AreEqual("junk", conn.connection.Database, "expect correct database name");
 }
예제 #4
0
 public WebSqlConnectResult Connect(WebSqlConnectRequest input)
 {
     var conn = new WebSqlConnection(input.serverName, input.databaseName, input.userId, input.password, 10);
     var connections = getConnections();
     var result = conn.connect();
     connections.Add(conn.guid, conn);
     return result;
 }
예제 #5
0
 public WebSqlCommandResultSet(WebSqlConnection conn)
 {
     this.connectionGuid = conn.guid.ToString();
     this.state = conn.state;
     this.results = new List<WebSqlCommandResult>();
 }