コード例 #1
0
        public ActionResult Delete(int id)
        {
            AjaxResult result = new AjaxResult();

            try
            {
                NormClass entity = m_FTISService.GetNormClassById(id);

                //檢查底下的SubNormClass數量
                IDictionary <string, string> conditions = new Dictionary <string, string>();
                conditions.Add("ParentNormClassId", id.ToString());
                conditions.Add("OnlySub", "OnlySub");
                int subsCount = m_FTISService.GetNormClassCount(conditions);
                if (subsCount > 0)
                {
                    return(this.Json(new AjaxResult(AjaxResultStatus.Fail, string.Format("{0}底下尚有國家分類,不可刪除。", entity.Name))));
                }
                m_FTISService.DeleteNormClass(entity);

                result.ErrorCode = AjaxResultStatus.Success;
                result.Message   = string.Format("{0}刪除成功", entity.Name);
            }
            catch (Exception ex)
            {
                result.ErrorCode = AjaxResultStatus.Exception;
                result.Message   = ex.Message;
            }

            return(this.Json(result));
        }
コード例 #2
0
        public ActionResult Detail(string id, string parentId)
        {
            string pId = DecryptId(parentId);

            SetConditions(string.Empty, string.Empty, pId);
            m_Conditions.Add("Status", "1");
            IList <Norm> normList = GetGridData().ToList();

            ViewData["NormList"] = normList;

            if (!string.IsNullOrWhiteSpace(parentId))
            {
                NormClass normClass = m_FTISService.GetNormClassById(int.Parse(pId));
                ViewData["NormClass"] = normClass;
            }

            NormModel model = new NormModel();

            if (!string.IsNullOrWhiteSpace(id))
            {
                model = new NormModel(id);
            }
            else
            {
                if (normList != null && normList.Count > 0)
                {
                    model = new NormModel(normList[0].NormId);
                }
            }

            return(View(model));
        }
コード例 #3
0
ファイル: co6662getnextargtype.cs プロジェクト: ydunk/masters
    private Boolean runTest(Boolean verbose)
    {
        int iCountErrors    = 0;
        int iCountTestcases = 0;

        try
        {
            ++iCountTestcases;
            if (verbose)
            {
                Console.WriteLine("GetNextArgType on Enumerator with no Elements in it should throw InvalidOperationException");
            }
            try {
                NormClass.argit1(__arglist(  ));
                ++iCountErrors;
                Console.WriteLine("Err_001b,  Expected exception was not thrown.");
            }
            catch (InvalidOperationException) {}
            catch (Exception ex) {
                ++iCountErrors;
                Console.WriteLine("Err_001a,  Unexpected exception was thrown ex: " + ex.ToString());
            }
            ++iCountTestcases;
            if (verbose)
            {
                Console.WriteLine("GetNextArgType on Enumerator after enumeration ended should result in InvalidOperationException");
            }
            try        {
                NormClass norm = new NormClass();
                norm.argit2(__arglist("a", "b", "c"));
            }
            catch (Exception ex) {
                ++iCountErrors;
                Console.WriteLine("Err_002a,  Unexpected exception was thrown ex: " + ex.ToString());
            }
        }
        catch (Exception exc_runTest)
        {
            ++iCountErrors;
            Console.Error.WriteLine(strName + " " + strTest + " " + strPath);
            Console.Error.WriteLine("Unexpected Exception (runTest99): " + exc_runTest.ToString());
        }
        Console.WriteLine();
        Console.WriteLine("FINAL TEST RESULT:" + strName + " " + strTest + " " + strPath);
        Console.WriteLine();
        if (iCountErrors == 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
コード例 #4
0
ファイル: co6665gethashcode.cs プロジェクト: ydunk/masters
    public static void argit2(__arglist)
    {
        ArgIterator args     = new ArgIterator(__arglist);
        int         hashcode = args.GetHashCode();

        try{
            NormClass.argit2b(__arglist(   ));
        }
        catch (InvalidOperationException) {}
        int hashcodecompare = args.GetHashCode();

        if (!hashcode.Equals(hashcodecompare))
        {
            throw new Exception("argit2 - 1, hashcode changed");
        }
    }
コード例 #5
0
 protected void LoadEntity(NormClass entity)
 {
     if (entity != null)
     {
         EntityId = entity.NormClassId;
         Name     = entity.Name;
         NameENG  = entity.NameENG;
         Pic1     = entity.Pic1;
         SortId   = entity.SortId;
         Status   = entity.Status;
         if (entity.ParentNormClass != null)
         {
             ParentEntity = entity.ParentNormClass;
             ParentId     = entity.ParentNormClass.NormClassId;
         }
     }
 }
コード例 #6
0
    private Boolean runTest(Boolean verbose)
    {
        int iCountErrors    = 0;
        int iCountTestcases = 0;

        try
        {
            ++iCountTestcases;
            if (verbose)
            {
                Console.WriteLine("Make sure GetRemainingCount is correctly incremented decremented for different arglists");
            }
            try {
                NormClass.argit1(__arglist( ));
                NormClass.argit1(__arglist("a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c"));
                NormClass.argit1(__arglist( ));
                NormClass.argit1(__arglist(typeof(System.String), null, (int)1975, (long)6, (float)4.3, BindingFlags.NonPublic, new Object(), new Hashtable(), (char)'a', (byte)0x80, "Some String", Guid.NewGuid(), Int16.MinValue, DateTime.Now));
                NormClass.argit1(__arglist( ));
            }
            catch (Exception ex) {
                ++iCountErrors;
                Console.WriteLine("Err_001a,  Unexpected exception was thrown ex: " + ex.ToString());
            }
        }
        catch (Exception exc_runTest)
        {
            ++iCountErrors;
            Console.Error.WriteLine(strName + " " + strTest + " " + strPath);
            Console.Error.WriteLine("Unexpected Exception (runTest99): " + exc_runTest.ToString());
        }
        Console.WriteLine();
        Console.WriteLine("FINAL TEST RESULT:" + strName + " " + strTest + " " + strPath);
        Console.WriteLine();
        if (iCountErrors == 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
コード例 #7
0
        public ActionResult SetSort(string entityId, string sortValue)
        {
            AjaxResult    result = new AjaxResult(AjaxResultStatus.Success, string.Empty);
            StringBuilder sbMsg  = new StringBuilder();

            try
            {
                NormClass entity = m_FTISService.GetNormClassById(Convert.ToInt32(entityId));
                entity.SortId = int.Parse(sortValue);
                m_FTISService.UpdateNormClass(entity);
            }
            catch (Exception ex)
            {
                result.ErrorCode = AjaxResultStatus.Fail;
                sbMsg.AppendFormat(ex.Message + "<br/>");
            }

            result.Message = sbMsg.ToString();
            return(this.Json(result));
        }
コード例 #8
0
 private Boolean runTest( Boolean verbose )
   {
   int iCountErrors = 0;
   int iCountTestcases = 0;
   try
     {
     ++iCountTestcases;   
     if ( verbose ) Console.WriteLine( "GetNextArgs on Enumerator with no Elements in it should throw InvalidOperationException" );	
     try{	
     NormClass.argit1( __arglist(  ) );
     ++iCountErrors;
     Console.WriteLine( "Err_001b,  Expected exception was not thrown." );
     }
     catch (InvalidOperationException) {}
     catch (Exception ex) {		
     ++iCountErrors;
     Console.WriteLine( "Err_001a,  Unexpected exception was thrown ex: " + ex.ToString() );
     }
     ++iCountTestcases;   
     if ( verbose ) Console.WriteLine( "GetNextArgs on Enumerator after enumeration ended should result in InvalidOperationException" );	
     try	{
     NormClass norm=new NormClass();
     norm.argit2( __arglist( "a", "b", "c" ) );	
     }
     catch (Exception ex) {
     ++iCountErrors;
     Console.WriteLine( "Err_002a,  Unexpected exception was thrown ex: " + ex.ToString() );
     }
     }
   catch (Exception exc_runTest)
     {
     ++iCountErrors;			
     Console.Error.WriteLine (strName+" "+strTest+" "+strPath);
     Console.Error.WriteLine ("Unexpected Exception (runTest99): "+exc_runTest.ToString());
     }
   Console.WriteLine ();
   Console.WriteLine ("FINAL TEST RESULT:" + strName+" "+strTest+" "+strPath);
   Console.WriteLine ();
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
コード例 #9
0
    private Boolean runTest(Boolean verbose)
    {
        int iCountErrors    = 0;
        int iCountTestcases = 0;

        try
        {
            ++iCountTestcases;
            if (verbose)
            {
                Console.WriteLine("checking if ArgIterator.Equals throws the NotSupportedException");
            }
            try        {
                NormClass.argit1(__arglist(   ));
            }
            catch (NotSupportedException) {}
            catch (Exception ex) {
                ++iCountErrors;
                Console.WriteLine("Err_008a,  Unexpected exception was thrown ex: " + ex.ToString());
            }
        }
        catch (Exception exc_runTest)
        {
            ++iCountErrors;
            Console.Error.WriteLine(strName + " " + strTest + " " + strPath);
            Console.Error.WriteLine("Unexpected Exception (runTest99): " + exc_runTest.ToString());
        }
        Console.WriteLine();
        Console.WriteLine("FINAL TEST RESULT:" + strName + " " + strTest + " " + strPath);
        Console.WriteLine();
        if (iCountErrors == 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
コード例 #10
0
        private void Save(NormClass entity)
        {
            if (ParentId > 0)
            {
                entity.ParentNormClass = m_FTISService.GetNormClassById(ParentId);
            }
            entity.Name    = Name;
            entity.NameENG = NameENG;
            entity.Pic1    = Pic1;
            entity.SortId  = SortId;
            entity.Status  = Status;

            if (entity.NormClassId == 0)
            {
                m_FTISService.CreateNormClass(entity);
            }
            else
            {
                m_FTISService.UpdateNormClass(entity);
            }

            LoadEntity(entity.NormClassId);
        }
コード例 #11
0
        public ActionResult MultiDelete(string allId)
        {
            AjaxResult    result = new AjaxResult(AjaxResultStatus.Success, string.Empty);
            StringBuilder sbMsg  = new StringBuilder();

            string[] ids = allId.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string id in ids)
            {
                try
                {
                    NormClass entity = m_FTISService.GetNormClassById(Convert.ToInt32(id));
                    //檢查底下的SubNormClass數量
                    IDictionary <string, string> conditions = new Dictionary <string, string>();
                    conditions.Add("ParentNormClassId", id.ToString());
                    conditions.Add("OnlySub", "OnlySub");
                    int subsCount = m_FTISService.GetNormClassCount(conditions);
                    if (subsCount == 0)
                    {
                        m_FTISService.DeleteNormClass(entity);
                    }
                    else
                    {
                        result.ErrorCode = AjaxResultStatus.Fail;
                        sbMsg.AppendFormat("{0},底下尚有國家分類,不可刪除。<br/>", entity.Name);
                    }
                }
                catch (Exception ex)
                {
                    result.ErrorCode = AjaxResultStatus.Fail;
                    sbMsg.AppendFormat(ex.Message + "<br/>");
                }
            }

            result.Message = sbMsg.ToString();
            return(this.Json(result));
        }
コード例 #12
0
ファイル: co6665gethashcode.cs プロジェクト: ArildF/masters
 private Boolean runTest( Boolean verbose )
   {
   int iCountErrors = 0;
   int iCountTestcases = 0;
   try
     {
     ++iCountTestcases;   
     if ( verbose ) {
     Console.WriteLine( "checking GetHashCode returns the same value ");
     Console.WriteLine( "checking if we can use ArgIterators on any class" );	
     }
     try	{
     NormClass st = new NormClass();
     Object[] o     = new Object[] { typeof(System.String), null, (int) 1975, (long) 6, (float) 4.3, BindingFlags.NonPublic, new Object(), new Hashtable(), (char) 'a', (byte) 0x80, "Some String", Guid.NewGuid(), Int16.MinValue, DateTime.Now };
     st.argit1( o, __arglist( (Type) o[0], o[1], (int) o[2], (long) o[3], (float) o[4], (BindingFlags) o[5], o[6], (Hashtable) o[7], (char) o[8],  (byte) o[9], (String) o[10], (Guid) o[11], (short) o[12], (DateTime) o[13] ) );
     }
     catch (Exception ex) {
     ++iCountErrors;
     Console.WriteLine( "Err_001a,  Unexpected exception was thrown ex: " + ex.ToString() );
     }
     ++iCountTestcases;   
     if ( verbose ){
     Console.WriteLine( "checking GetHashCode returns the same value ");
     Console.WriteLine( "checking ArgIterators with Arrays" );	
     }
     try	{
     NormClass st = new NormClass();
     Object[,] compObj = new Object[2,2];
     Object[] o = new Object[] {  new DBNull[]{}, new Object[]{}, compObj };
     st.argit1( o, __arglist(    (DBNull[]) o[0], 
				 (Object[]) o[1], 
				 (Object[,]) o[2] ) );
     }
     catch (Exception ex) {
     ++iCountErrors;
     Console.WriteLine( "Err_001b,  Unexpected exception was thrown ex: " + ex.ToString() );
     }
     ++iCountTestcases;   
     if ( verbose ){
     Console.WriteLine( "checking GetHashCode returns the same value ");
     Console.WriteLine( "check nesting of ArgIterators " );	
     }
     try	{
     NormClass.argit2( __arglist( "a", "b", "c" ) );				
     }
     catch (Exception ex) {
     ++iCountErrors;
     Console.WriteLine( "Err_002a,  Unexpected exception was thrown ex: " + ex.ToString() );
     }			
     }
   catch (Exception exc_runTest)
     {
     ++iCountErrors;			
     Console.Error.WriteLine (strName+" "+strTest+" "+strPath);
     Console.Error.WriteLine ("Unexpected Exception (runTest99): "+exc_runTest.ToString());
     }
   Console.WriteLine ();
   Console.WriteLine ("FINAL TEST RESULT:" + strName+" "+strTest+" "+strPath);
   Console.WriteLine ();
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
コード例 #13
0
        public void Insert()
        {
            NormClass entity = new NormClass();

            Save(entity);
        }
コード例 #14
0
        public void Update()
        {
            NormClass entity = m_FTISService.GetNormClassById(EntityId);

            Save(entity);
        }
コード例 #15
0
    public Boolean runTest()
    {
        Console.Error.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strComponentBeingTested + "  ,Source ver " + s_strDtTmVer);
        int iCountTestcases = 0;
        int iCountErrors    = 0;

        ++iCountTestcases;
        if (verbose)
        {
            Console.WriteLine("call GetNextArgs on Enumerator with no Elements in it should throw InvalidOperationException");
        }
        try
        {
            NormClass.argit0(__arglist(  ));
            ++iCountErrors;
            Console.WriteLine("Err_001b,  Expected exception was not thrown.");
        }
        catch (InvalidOperationException)
        {}
        catch (Exception ex)
        {
            ++iCountErrors;
            Console.WriteLine("Err_001a,  Unexpected exception was thrown ex: " + ex.ToString());
        }
        ++iCountTestcases;
        if (verbose)
        {
            Console.WriteLine("call GetNextArgs on Enumerator after enumeration ended should result in InvalidOperationException");
        }
        try
        {
            NormClass.argit1(__arglist("a", "b", "c"));
        }
        catch (Exception ex)
        {
            ++iCountErrors;
            Console.WriteLine("Err_002a,  Unexpected exception was thrown ex: " + ex.ToString());
        }
        ++iCountTestcases;
        if (verbose)
        {
            Console.WriteLine("Make sure GetRemainingCount is correctly incremented decremented for different arglists");
        }
        try
        {
            NormStruct.argit0(__arglist( ));
            NormStruct.argit0(__arglist("a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c"));
        }
        catch (Exception ex)
        {
            ++iCountErrors;
            Console.WriteLine("Err_003a,  Unexpected exception was thrown ex: " + ex.ToString());
        }
        ++iCountTestcases;
        if (verbose)
        {
            Console.WriteLine("call GetNextArgType on Enumerator with no Elements in it should throw InvalidOperationException");
        }
        try
        {
            NormClass.argit2(__arglist(  ));
            ++iCountErrors;
            Console.WriteLine("Err_004b,  Expected exception was not thrown.");
        }
        catch (InvalidOperationException)
        {}
        catch (Exception ex)
        {
            ++iCountErrors;
            Console.WriteLine("Err_004a,  Unexpected exception was thrown ex: " + ex.ToString());
        }
        ++iCountTestcases;
        if (verbose)
        {
            Console.WriteLine("call GetNextArgType on Enumerator after enumeration ended should result in InvalidOperationException");
        }
        try
        {
            NormClass.argit3(__arglist("a", "b", "c"));
        }
        catch (Exception ex)
        {
            ++iCountErrors;
            Console.WriteLine("Err_005a,  Unexpected exception was thrown ex: " + ex.ToString());
        }
        ++iCountTestcases;
        if (verbose)
        {
            Console.WriteLine("call GetNextArgType on Enumerator after enumeration ended should result in InvalidOperationException");
        }
        try
        {
            NormClass st = new NormClass();
            Object[]  o  = new Object[] { typeof(System.String), null, (int)1975, (long)6, (float)4.3, BindingFlags.NonPublic, new Object(), new Hashtable(), (char)'a', (byte)0x80, "Some String", Guid.NewGuid(), Int16.MinValue, DateTime.Now };
            st.argit6(o, __arglist((Type)o[0],
                                   o[1],
                                   (int)o[2],
                                   (long)o[3],
                                   (float)o[4],
                                   (BindingFlags)o[5],
                                   o[6],
                                   (Hashtable)o[7],
                                   (char)o[8],
                                   (byte)o[9],
                                   (String)o[10],
                                   (Guid)o[11],
                                   (short)o[12],
                                   (DateTime)o[13]));
        }
        catch (Exception ex)
        {
            ++iCountErrors;
            Console.WriteLine("Err_005a,  Unexpected exception was thrown ex: " + ex.ToString());
        }
        ++iCountTestcases;
        if (verbose)
        {
            Console.WriteLine("call GetNextArgType on Enumerator after enumeration ended should result in InvalidOperationException");
        }
        try
        {
            NormClass st = new NormClass();
            Object[,] compObj = new Object[2, 2];
            Object[] o = new Object[] { new DBNull[] {}, new Object[] {}, compObj };
            st.argit6(o, __arglist((DBNull[])o[0],
                                   (Object[])o[1],
                                   (Object[, ])o[2]));
        }
        catch (Exception ex)
        {
            ++iCountErrors;
            Console.WriteLine("Err_005a,  Unexpected exception was thrown ex: " + ex.ToString());
        }
        if (iCountErrors == 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
コード例 #16
0
    private Boolean runTest(Boolean verbose)
    {
        int iCountErrors    = 0;
        int iCountTestcases = 0;

        try
        {
//TEST 1
            //Part A
            // [] check to see if we can use ArgIterators on any class
            ++iCountTestcases;
            try     {
                NormClass  st  = new NormClass();
                Object[]   o   = new Object[] { (int)1975 };
                TestStruct Bar = st.argit1(o, __arglist((int)o[0]));
            }
            catch (Exception ex) {
                ++iCountErrors;
                Console.WriteLine("Err_001a,  Unexpected exception was thrown ex: " + ex.ToString());
            }


            //Part B
            // [] check ArgIterators on Arrays
            ++iCountTestcases;
            if (verbose)
            {
                Console.WriteLine("checking GetHashCode returns the same value ");
                Console.WriteLine("checking ArgIterators with Arrays");
            }
            try     {
                NormClass st = new NormClass();
                Object[,] compObj = new Object[2, 2];

                Object[] o = new Object[] { new DBNull[] {}, new Object[] {}, compObj };
                st.argit1(o, __arglist((DBNull[])o[0],
                                       (Object[])o[1],
                                       (Object[, ])o[2]));
            }
            catch (Exception ex) {
                ++iCountErrors;
                Console.WriteLine("Err_001b,  Unexpected exception was thrown ex: " + ex.ToString());
            }
            //////////////////////////////////



//TEST 2
            // [] check nesting of ArgIterators
            ++iCountTestcases;
            if (verbose)
            {
                Console.WriteLine("checking GetHashCode returns the same value ");
                Console.WriteLine("check nesting of ArgIterators ");
            }
            try     {
                NormClass.argit2(__arglist("a", "b", "c"));
            }
            catch (Exception ex) {
                ++iCountErrors;
                Console.WriteLine("Err_002a,  Unexpected exception was thrown ex: " + ex.ToString());
            }
            //////////////////////////////////
        }


        catch (Exception exc_runTest)
        {
            ++iCountErrors;
            Console.Error.WriteLine(strName + " " + strTest + " " + strPath);
            Console.Error.WriteLine("Unexpected Exception (runTest99): " + exc_runTest.ToString());
        }



        //////////////////////////// Test Results ////////////////////////////////
        Console.WriteLine();
        Console.WriteLine("///////// FINAL TEST RESULT:" + strName + " " + strTest + " " + strPath);
        Console.WriteLine();
        //////////////////////////// Test Results ////////////////////////////////

        if (iCountErrors == 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
コード例 #17
0
ファイル: co6665gethashcode.cs プロジェクト: ydunk/masters
    private Boolean runTest(Boolean verbose)
    {
        int iCountErrors    = 0;
        int iCountTestcases = 0;

        try
        {
            ++iCountTestcases;
            if (verbose)
            {
                Console.WriteLine("checking GetHashCode returns the same value ");
                Console.WriteLine("checking if we can use ArgIterators on any class");
            }
            try        {
                NormClass st = new NormClass();
                Object[]  o  = new Object[] { typeof(System.String), null, (int)1975, (long)6, (float)4.3, BindingFlags.NonPublic, new Object(), new Hashtable(), (char)'a', (byte)0x80, "Some String", Guid.NewGuid(), Int16.MinValue, DateTime.Now };
                st.argit1(o, __arglist((Type)o[0], o[1], (int)o[2], (long)o[3], (float)o[4], (BindingFlags)o[5], o[6], (Hashtable)o[7], (char)o[8], (byte)o[9], (String)o[10], (Guid)o[11], (short)o[12], (DateTime)o[13]));
            }
            catch (Exception ex) {
                ++iCountErrors;
                Console.WriteLine("Err_001a,  Unexpected exception was thrown ex: " + ex.ToString());
            }
            ++iCountTestcases;
            if (verbose)
            {
                Console.WriteLine("checking GetHashCode returns the same value ");
                Console.WriteLine("checking ArgIterators with Arrays");
            }
            try        {
                NormClass st = new NormClass();
                Object[,] compObj = new Object[2, 2];
                Object[] o = new Object[] { new DBNull[] {}, new Object[] {}, compObj };
                st.argit1(o, __arglist((DBNull[])o[0],
                                       (Object[])o[1],
                                       (Object[, ])o[2]));
            }
            catch (Exception ex) {
                ++iCountErrors;
                Console.WriteLine("Err_001b,  Unexpected exception was thrown ex: " + ex.ToString());
            }
            ++iCountTestcases;
            if (verbose)
            {
                Console.WriteLine("checking GetHashCode returns the same value ");
                Console.WriteLine("check nesting of ArgIterators ");
            }
            try        {
                NormClass.argit2(__arglist("a", "b", "c"));
            }
            catch (Exception ex) {
                ++iCountErrors;
                Console.WriteLine("Err_002a,  Unexpected exception was thrown ex: " + ex.ToString());
            }
        }
        catch (Exception exc_runTest)
        {
            ++iCountErrors;
            Console.Error.WriteLine(strName + " " + strTest + " " + strPath);
            Console.Error.WriteLine("Unexpected Exception (runTest99): " + exc_runTest.ToString());
        }
        Console.WriteLine();
        Console.WriteLine("FINAL TEST RESULT:" + strName + " " + strTest + " " + strPath);
        Console.WriteLine();
        if (iCountErrors == 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
コード例 #18
0
ファイル: varargtest2.cs プロジェクト: ArildF/masters
	private Boolean runTest( Boolean verbose )
	{
		int iCountErrors = 0;
		int iCountTestcases = 0;

		try
		{

			
//TEST 1
	//Part A
			// [] check to see if we can use ArgIterators on any class
			++iCountTestcases; 
			try	{
				NormClass st = new NormClass();
				Object[] o     = new Object[] {  (int) 1975 };
				TestStruct Bar = st.argit1( o, __arglist(  (int)o[0] ) );
			}
			catch (Exception ex) {
			  ++iCountErrors;
		      Console.WriteLine( "Err_001a,  Unexpected exception was thrown ex: " + ex.ToString() );
			}


	//Part B
			// [] check ArgIterators on Arrays
			++iCountTestcases;   
			if ( verbose ){
				Console.WriteLine( "checking GetHashCode returns the same value ");
				Console.WriteLine( "checking ArgIterators with Arrays" );	
			}
			try	{
				NormClass st = new NormClass();
				Object[,] compObj = new Object[2,2];

				Object[] o = new Object[] {  new DBNull[]{}, new Object[]{}, compObj };
				st.argit1( o, __arglist(    (DBNull[]) o[0], 
										(Object[]) o[1], 
										(Object[,]) o[2] ) );

			}
			catch (Exception ex) {
			  	++iCountErrors;
		      	Console.WriteLine( "Err_001b,  Unexpected exception was thrown ex: " + ex.ToString() );
			}
			//////////////////////////////////


			
//TEST 2
			// [] check nesting of ArgIterators 
			++iCountTestcases;   
			if ( verbose ){
				Console.WriteLine( "checking GetHashCode returns the same value ");
				Console.WriteLine( "check nesting of ArgIterators " );	
			}
			try	{
					NormClass.argit2( __arglist( "a", "b", "c" ) );				
			}
			catch (Exception ex) {
			  	++iCountErrors;
		      	Console.WriteLine( "Err_002a,  Unexpected exception was thrown ex: " + ex.ToString() );
			}			
			//////////////////////////////////

			
		}
			

		catch (Exception exc_runTest)
		{
			++iCountErrors;			
			Console.Error.WriteLine (strName+" "+strTest+" "+strPath);
			Console.Error.WriteLine ("Unexpected Exception (runTest99): "+exc_runTest.ToString());
		}



		//////////////////////////// Test Results ////////////////////////////////
		Console.WriteLine ();
		Console.WriteLine ("///////// FINAL TEST RESULT:" + strName+" "+strTest+" "+strPath);
		Console.WriteLine ();
		//////////////////////////// Test Results ////////////////////////////////
                		
		if ( iCountErrors == 0 ) {   return true; }
		else { return false;}
		
	}
コード例 #19
0
ファイル: co1827argiterator.cs プロジェクト: ArildF/masters
 public Boolean runTest()
   {
   Console.Error.WriteLine( s_strTFPath + " " + s_strTFName + " , for " + s_strComponentBeingTested + "  ,Source ver " + s_strDtTmVer );
   int iCountTestcases = 0;
   int iCountErrors    = 0;
   ++iCountTestcases;   
   if ( verbose ) Console.WriteLine( "call GetNextArgs on Enumerator with no Elements in it should throw InvalidOperationException" );	
   try
     {
     NormClass.argit0( __arglist(  ) );
     ++iCountErrors;
     Console.WriteLine( "Err_001b,  Expected exception was not thrown." );
     }
   catch (InvalidOperationException)
     {}
   catch (Exception ex)
     {
     ++iCountErrors;
     Console.WriteLine( "Err_001a,  Unexpected exception was thrown ex: " + ex.ToString() );
     }
   ++iCountTestcases;   
   if ( verbose ) Console.WriteLine( "call GetNextArgs on Enumerator after enumeration ended should result in InvalidOperationException" );	
   try
     {
     NormClass.argit1( __arglist( "a", "b", "c" ) );
     }
   catch (Exception ex)
     {
     ++iCountErrors;
     Console.WriteLine( "Err_002a,  Unexpected exception was thrown ex: " + ex.ToString() );
     }
   ++iCountTestcases;   
   if ( verbose ) Console.WriteLine( "Make sure GetRemainingCount is correctly incremented decremented for different arglists" );	
   try
     {
     NormStruct.argit0( __arglist( ) );
     NormStruct.argit0( __arglist( "a", "b", "c", "a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c","a", "b", "c"  ) );
     }
   catch (Exception ex)
     {
     ++iCountErrors;
     Console.WriteLine( "Err_003a,  Unexpected exception was thrown ex: " + ex.ToString() );
     }
   ++iCountTestcases;   
   if ( verbose ) Console.WriteLine( "call GetNextArgType on Enumerator with no Elements in it should throw InvalidOperationException" );	
   try
     {
     NormClass.argit2( __arglist(  ) );
     ++iCountErrors;
     Console.WriteLine( "Err_004b,  Expected exception was not thrown." );
     }
   catch (InvalidOperationException)
     {}
   catch (Exception ex)
     {
     ++iCountErrors;
     Console.WriteLine( "Err_004a,  Unexpected exception was thrown ex: " + ex.ToString() );
     }
   ++iCountTestcases;   
   if ( verbose ) Console.WriteLine( "call GetNextArgType on Enumerator after enumeration ended should result in InvalidOperationException" );	
   try
     {
     NormClass.argit3( __arglist( "a", "b", "c" ) );
     }
   catch (Exception ex)
     {
     ++iCountErrors;
     Console.WriteLine( "Err_005a,  Unexpected exception was thrown ex: " + ex.ToString() );
     }
   ++iCountTestcases;   
   if ( verbose ) Console.WriteLine( "call GetNextArgType on Enumerator after enumeration ended should result in InvalidOperationException" );	
   try
     {
     NormClass st = new NormClass();
     Object[] o = new Object[] { typeof(System.String), null, (int) 1975, (long) 6, (float) 4.3, BindingFlags.NonPublic, new Object(), new Hashtable(), (char) 'a', (byte) 0x80, "Some String", Guid.NewGuid(), Int16.MinValue, DateTime.Now };
     st.argit6( o, __arglist(   (Type) o[0], 
				o[1], 
				(int) o[2], 
				(long) o[3], 
				(float) o[4], 
				(BindingFlags) o[5],
				o[6], 
				(Hashtable) o[7],
				(char) o[8], 
				(byte) o[9], 
				(String) o[10],
				(Guid) o[11], 
				(short) o[12], 
				(DateTime) o[13] ) );
     }
   catch (Exception ex)
     {
     ++iCountErrors;
     Console.WriteLine( "Err_005a,  Unexpected exception was thrown ex: " + ex.ToString() );
     }
   ++iCountTestcases;   
   if ( verbose ) Console.WriteLine( "call GetNextArgType on Enumerator after enumeration ended should result in InvalidOperationException" );	
   try
     {
     NormClass st = new NormClass();
     Object[,] compObj = new Object[2,2];
     Object[] o = new Object[] {  new DBNull[]{}, new Object[]{}, compObj };
     st.argit6( o, __arglist(    (DBNull[]) o[0], 
				 (Object[]) o[1], 
				 (Object[,]) o[2] ) );
     }
   catch (Exception ex)
     {
     ++iCountErrors;
     Console.WriteLine( "Err_005a,  Unexpected exception was thrown ex: " + ex.ToString() );
     }
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }
コード例 #20
0
        protected void LoadEntity(int id)
        {
            NormClass entity = m_FTISService.GetNormClassById(id);

            LoadEntity(entity);
        }