当前位置: 首页>>代码示例>>C#>>正文


C# Connection.ToString方法代码示例

本文整理汇总了C#中Connection.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Connection.ToString方法的具体用法?C# Connection.ToString怎么用?C# Connection.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Connection的用法示例。


在下文中一共展示了Connection.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateConnection1Args

        public void CreateConnection1Args()
        {
            //
            // --------------- Constructor 1 Arguments ------------------------------------------
            //
            var connFull = new Connection(".", "UsersManagements", "um");
            var conn = new Connection(connFull);

            Assert.AreEqual(conn.ToXml(false).ToString(SaveOptions.None), conn.ToString());
            Assert.AreEqual(conn.ToXml(true).ToString(SaveOptions.None), conn.ToString(true));
            var newConnWithoutId = conn.ToXml(true);
            TestTools.ExceptException<NullReferenceException>(() => newConnWithoutId.Element("add").Attribute("publicKeyToken").Value = "");
            var c = Connection.Parse(newConnWithoutId);
            Assert.AreEqual(c.ConnectionString, conn.ConnectionString); // c.Id != conn.Id but both of them have duplicate connectionString

            var conn2 = new Connection(conn.ConnectionString);

            TestTools.ExpectException<NullReferenceException>(() => conn.ConnectionString = null); // Test throw NullReferenceException

            Assert.AreEqual(conn.ConnectionString, conn2.ConnectionString);
        }
开发者ID:eric-seekas,项目名称:ErrorControlSystem,代码行数:21,代码来源:UnitTest.cs

示例2: CreateConnection2Args

        public void CreateConnection2Args()
        {
            //
            // --------------- Constructor 2 Arguments ------------------------------------------
            //
            var connFull = new Connection(".", "UsersManagements", "sa", "123", 3, "Test Connection", "um");
            var conn = new Connection(connFull.ConnectionString);

            Assert.AreEqual(conn.ToXml(false).ToString(SaveOptions.None), conn.ToString());
            Assert.AreEqual(conn.ToXml(true).ToString(SaveOptions.None), conn.ToString(true));
            Assert.AreEqual(
                Connection.Parse(conn.ToXml(true)).ConnectionString,
                conn.ConnectionString);

            var conn2 = new Connection(conn.ConnectionString);

            Assert.AreEqual(conn.ConnectionString, conn2.ConnectionString);
        }
开发者ID:eric-seekas,项目名称:ErrorControlSystem,代码行数:18,代码来源:UnitTest.cs

示例3: CreateConnection8Args

        public void CreateConnection8Args()
        {
            //
            // --------------- Constructor 8 Arguments ------------------------------------------
            //
            var conn3 = new Connection(".", "UsersManagements", "sa", "123", 3, "Test Connection", "name");

            Assert.AreEqual(conn3.ToXml(false).ToString(SaveOptions.None), conn3.ToString());
            Assert.AreEqual(conn3.ToXml(true).ToString(SaveOptions.None), conn3.ToString(true));
            Assert.AreEqual(
                Connection.Parse(conn3.ToXml(true)).ConnectionString,
                conn3.ConnectionString);

            var conn3_2 = new Connection()
            {
                ConnectionString = conn3.ConnectionString
            };

            Assert.AreEqual(conn3.ConnectionString, conn3_2.ConnectionString);
        }
开发者ID:eric-seekas,项目名称:ErrorControlSystem,代码行数:20,代码来源:UnitTest.cs

示例4: CreateConnection6Args

        public void CreateConnection6Args()
        {
            //
            // --------------- Constructor 6 Arguments ------------------------------------------
            //
            var conn2 = new Connection(".", "UsersManagements", "sa", "123", -3);

            Assert.AreEqual(conn2.ToXml().ToString(SaveOptions.None), conn2.ToString());
            Assert.AreEqual(conn2.ToXml(true).ToString(SaveOptions.None), conn2.ToString(true));
            Assert.AreEqual(
                Connection.Parse(conn2.ToXml(true)).ConnectionString,
                conn2.ConnectionString);

            var conn2_2 = new Connection()
            {
                ConnectionString = conn2.ConnectionString
            };

            Assert.AreEqual(conn2.ConnectionString, conn2_2.ConnectionString);
        }
开发者ID:eric-seekas,项目名称:ErrorControlSystem,代码行数:20,代码来源:UnitTest.cs

示例5: CreateConnection4Args

        public void CreateConnection4Args()
        {
            //
            // --------------- Constructor 4 Arguments ------------------------------------------
            //
            var conn = new Connection();

            Assert.AreEqual(conn.ToXml().ToString(SaveOptions.None), conn.ToString());
            Assert.AreEqual(conn.ToXml(true).ToString(SaveOptions.None), conn.ToString(true));
            Assert.AreEqual(
                Connection.Parse(conn.ToXml(true)).ConnectionString,
                conn.ConnectionString);

            var conn1_2 = new Connection()
            {
                ConnectionString = conn.ConnectionString
            };

            Assert.AreEqual(conn.ConnectionString, conn1_2.ConnectionString);
        }
开发者ID:eric-seekas,项目名称:ErrorControlSystem,代码行数:20,代码来源:UnitTest.cs

示例6: CreateConnection3Args

 public void CreateConnection3Args()
 {
     //
     // --------------- Constructor 3 Arguments ------------------------------------------
     //
     var conn1 = new Connection(".", "UsersManagements");
     conn1.Name = "UM";
     Assert.AreEqual(conn1.ToXml().ToString(SaveOptions.None), conn1.ToString());
     Assert.AreEqual(conn1.ToXml(true).ToString(SaveOptions.None), conn1.ToString(true));
     Assert.AreEqual(
         Connection.Parse(conn1.ToXml(true)).ConnectionString,
         conn1.ConnectionString);
 }
开发者ID:eric-seekas,项目名称:ErrorControlSystem,代码行数:13,代码来源:UnitTest.cs

示例7: ToString_EmptyObject_Expected_

 public void ToString_EmptyObject_Expected_()
 {
     Connection testConnection = new Connection();
     string actualSerializedConnection = testConnection.ToString();
     string expected = JsonConvert.SerializeObject(testConnection);
     Assert.AreEqual(expected, actualSerializedConnection);
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:7,代码来源:ConnectionTests.cs

示例8: connection_TransmitEvent

 /// <summary>
 /// EventHandler method
 /// this will triggers whenever the sender sends transmit data action 
 /// process web view TargetURL
 /// Load Url
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void connection_TransmitEvent(object sender, Connection.Event.TransmitEventArgs e)
 {
     this.Invoke((MethodInvoker)delegate
     {
         /// Load url whenever e is not equal to TargetURL
         if (string.Compare(this.WebViewControl.Source.AbsoluteUri, e.ToString(), true) != 0)
             this.WebViewControl.LoadURL(e.ToString());
     });
 }
开发者ID:AaronTrazona,项目名称:BusTerminalApplication,代码行数:17,代码来源:MainForm.cs


注:本文中的Connection.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。