コード例 #1
0
ファイル: Program.cs プロジェクト: tabuang11/CalculateGrade
        static void UnitTest()
        {
            for (Int16 i = -1; i <= 101; i++)
            {
                Code1  codedata1  = new Code1(i);
                Code2  codedata2  = new Code2(i);
                Code3  codedata3  = new Code3(i);
                Code4  codedata4  = new Code4(i);
                Code5  codedata5  = new Code5(i);
                Code6  codedata6  = new Code6(i);
                Code7  codedata7  = new Code7(i);
                Code8  codedata8  = new Code8(i);
                Code9  codedata9  = new Code9(i);
                Code10 codedata10 = new Code10(i);

                if (codedata1.dataGrade != codedata2.dataGrade ||
                    codedata2.dataGrade != codedata3.dataGrade ||
                    codedata3.dataGrade != codedata4.dataGrade ||
                    codedata4.dataGrade != codedata5.dataGrade ||
                    codedata5.dataGrade != codedata6.dataGrade ||
                    codedata6.dataGrade != codedata7.dataGrade ||
                    codedata7.dataGrade != codedata8.dataGrade ||
                    codedata8.dataGrade != codedata9.dataGrade ||
                    codedata9.dataGrade != codedata10.dataGrade
                    )
                {
                    throw new Exception("Score: " + i + " is not equal Grade");
                }
            }
            Console.WriteLine("Score -1 to 101 checking Grade is Complated.");
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: tabuang11/CalculateGrade
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                UnitTest();
            }
            else
            {
                Console.Write("Please input your grade here : ");
                int    dataPoint  = Convert.ToInt32(Console.ReadLine());
                Code1  codedata1  = new Code1(dataPoint);
                Code2  codedata2  = new Code2(dataPoint);
                Code3  codedata3  = new Code3(dataPoint);
                Code4  codedata4  = new Code4(dataPoint);
                Code5  codedata5  = new Code5(dataPoint);
                Code6  codedata6  = new Code6(dataPoint);
                Code7  codedata7  = new Code7(dataPoint);
                Code8  codedata8  = new Code8(dataPoint);
                Code9  codedata9  = new Code9(dataPoint);
                Code10 codedata10 = new Code10(dataPoint);

                Console.WriteLine("Code 01 Result :" + codedata1.dataGrade);
                Console.WriteLine("Code 02 Result :" + codedata2.dataGrade);
                Console.WriteLine("Code 03 Result :" + codedata3.dataGrade);
                Console.WriteLine("Code 04 Result :" + codedata4.dataGrade);
                Console.WriteLine("Code 05 Result :" + codedata5.dataGrade);
                Console.WriteLine("Code 06 Result :" + codedata6.dataGrade);
                Console.WriteLine("Code 07 Result :" + codedata7.dataGrade);
                Console.WriteLine("Code 08 Result :" + codedata8.dataGrade);
                Console.WriteLine("Code 09 Result :" + codedata9.dataGrade);
                Console.WriteLine("Code 10 Result :" + codedata10.dataGrade);
            }
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Code1 code1 = db.Codes1.Find(id);

            db.Codes1.Remove(code1);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "Id,Name,FullName,Description")] Code1 code1)
 {
     if (ModelState.IsValid)
     {
         db.Entry(code1).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(code1));
 }
コード例 #5
0
        // GET: Code1/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Code1 code1 = db.Codes1.Find(id);

            if (code1 == null)
            {
                return(HttpNotFound());
            }
            return(View(code1));
        }
コード例 #6
0
        public ActionResult Create([Bind(Include = "Id,Name,FullName,Description")] Code1 code1)
        {
            var objDb = db.Codes1.FirstOrDefault(x => x.Name == code1.Name);

            if (objDb != null)
            {
            }
            if (ModelState.IsValid)
            {
                db.Codes1.Add(code1);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(code1));
        }
コード例 #7
0
ファイル: Code1.cs プロジェクト: Smlep/Illumnia
 void Awake()
 {
     main = this;
 }