• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 使用NUnit進行并發測試

    發表于:2009-04-09來源:作者:點擊數: 標簽:nunitNUnitNunit
    下面的代碼將演示如何使用 NUnit 進行并發 測試 ,啟動多線程插入多個數據,并在插入完數據后刪除數據 using System; using System.Collections.Generic; using System.Text; using NUnit.Framework; using WYEng. SQL ServerDAL; using System.Threading; us
    下面的代碼將演示如何使用NUnit進行并發測試,啟動多線程插入多個數據,并在插入完數據后刪除數據

     

    using System;
    using System.Collections.Generic;
    using System.Text;
    using NUnit.Framework;
    using WYEng.SQLServerDAL;
    using System.Threading;
    using System.Data;
    using System.Data.SqlClient;

    namespace WYEng.TestUnit
    ...{
        [TestFixture]
        public class ExamComputerInfo
        ...{
            SQLServerDAL.ExamComputerInfo computerInfo;
            WYEng.Model.ExamComputerInfo mCompuerInfo;
            private int j = 0;
            private int computerID = 0;
            private string PARAM_COMPUTERID = "@ComputerID";
            [SetUp]
            public void CreateObject()
            ...{
                computerInfo = new WYEng.SQLServerDAL.ExamComputerInfo();
                mCompuerInfo = new WYEng.Model.ExamComputerInfo();
                TestGetComputerID();
            }

            [TearDown]
            public void DeleteObject()
            ...{
                TestDeleteComputerInfo();
                computerInfo = null;
                mCompuerInfo = null;

            }
            private void TestGetComputerID()
            ...{
                computerID = XPWY.DBUtility.DBHelperSQL.GetMaxID("ComputerID", "ExamComputerInfo");
            }
            private void TestDeleteComputerInfo()
            ...{
                Console.WriteLine(computerID.ToString());
                string strSql = "DELETE FROM ExamComputerInfo WHERE ComputerID>=@ComputerID";
                SqlParameter pram = new SqlParameter(PARAM_COMPUTERID, SqlDbType.Int);
                pram.Value = computerID;
                XPWY.DBUtility.DBHelperSQL.ExecuteSql(strSql,pram);
            }
            [Test]
            [Ignore("為了測試并發插入的問題,屏蔽該方法")]
            public void GetComputerInfo()
            ...{
                Thread[] threads = new Thread[1000];
                for (int i = 0; i < 1000; i++)
                ...{
                    Thread t = new Thread(new ThreadStart(Func));
                    threads[i] = t;
                }
                for (int i = 0; i < 1000; i++)
                ...{
            

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>