예제 #1
0
 /// <summary>
 /// If existing running test cases, change the status to Other.
 /// </summary>
 public void FinishTest()
 {
     // Clear RunningTestCase
     if (RunningTestCase != null)
     {
         if (RunningTestCase.Status == TestCaseStatus.Running)
         {
             GroupByOutcome.ChangeStatus(RunningTestCase.Name, TestCaseStatus.NotRun);
         }
         RunningTestCase = null;
     }
     foreach (var testcase in AllTestCases)
     {
         // Clear Waiting cases.
         if (testcase.Status == TestCaseStatus.Waiting && CurrentPageCaseList.Contains(testcase.Name))
         {
             TestCaseStatus status = TestCaseStatus.NotRun;
             if (testcase.LogUri != null && System.IO.File.Exists(testcase.LogUri.AbsolutePath))
             {
                 Utility.ParseFileGetStatus(testcase.LogUri.AbsolutePath, out status);
             }
             testcase.Status = status;
         }
         // Clear Running cases. Should not be here
         if (testcase.Status == TestCaseStatus.Running && CurrentPageCaseList.Contains(testcase.Name))
         {
             testcase.Status = TestCaseStatus.NotRun;
             RunningTestCase = null;
         }
     }
 }
예제 #2
0
        public static void Main(string[] args)
        {
            TestCaseStatus test1Status = TestCaseStatus.Pass;

            Console.WriteLine(test1Status);
            Console.ReadLine();
        }
예제 #3
0
        /// <summary>
        /// Parse the file content to get the case status
        /// Result format in file: "Result":"Result: Passed"
        /// </summary>
        public static bool ParseFileGetStatus(string filePath, out TestCaseStatus status)
        {
            status = TestCaseStatus.NotRun;

            string content    = File.ReadAllText(filePath);
            int    startIndex = content.IndexOf(AppConfig.ResultKeyword);

            startIndex += AppConfig.ResultKeyword.Length;
            int    endIndex  = content.IndexOf("\"", startIndex);
            string statusStr = content.Substring(startIndex, endIndex - startIndex);

            switch (statusStr)
            {
            case AppConfig.HtmlLogStatusPassed:
                status = TestCaseStatus.Passed;
                break;

            case AppConfig.HtmlLogStatusFailed:
                status = TestCaseStatus.Failed;
                break;

            case AppConfig.HtmlLogStatusInconclusive:
                status = TestCaseStatus.Other;
                break;

            default:
                // The file name format is not correct
                return(false);
            }

            return(true);
        }
예제 #4
0
        /// <summary>
        /// Change status for test run test case
        /// </summary>
        /// <param name="testRunCaseId">Test run case id</param>
        /// <param name="status">New status</param>
        /// <returns>Test run case with new status</returns>
        public async Task ChangeStatus(long testRunCaseId, TestCaseStatus status)
        {
            //var testRunCase = await _repository.TestRunCases.Where(trc => trc.Id == testRunCaseId).SingleOrDefaultAsync();

            //testRunCase.Status = status;

            //return testRunCase;
        }
예제 #5
0
파일: Program.cs 프로젝트: zinkoviktor/SS
        static void FirstSubTask()
        {
            TestCaseStatus test1Status = TestCaseStatus.Pass;

            Console.WriteLine(test1Status);

            Console.Write("\nPress any key to continue . . . ");
            Console.ReadKey();
        }
예제 #6
0
        public virtual void init(TestCaseStatus status)
        {
            //检查该id对象是否出现

            if(status == TestCaseStatus.验证测试)
            {
                Error();
            }
            Pass();
        }
예제 #7
0
        public virtual void init(TestCaseStatus status)
        {
            //检查该id对象是否出现

            if (status == TestCaseStatus.验证测试)
            {
                Error();
            }
            Pass();
        }
 /// <summary>
 /// Update the case status and case log
 /// Find the related case name, change its status and show log to user
 /// </summary>
 public void UpdateCaseFromHtmlLog(TestCaseStatus status, string testCaseName, string testCaseLogPath)
 {
     runningTestCase = AllTestCases.FirstOrDefault(c => c.Name == testCaseName);
     if (runningTestCase == null)
     {
         return;
     }
     GroupByOutcome.ChangeStatus(testCaseName, status);
     runningTestCase.LogUri = new Uri(testCaseLogPath);
     runningTestCase        = null;
 }
        static void Main(string[] args)
        {
            int day, month;

            Console.WriteLine("Please enter an integer" +
                              " that represents a day");
            day = System.Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Please enter an integer" +
                              " that represents a month");
            month = System.Convert.ToInt32(Console.ReadLine());

            string result = ((day < 31) && (month <= 12)) ?
                            "possible" : "not possible";

            Console.WriteLine("Input values for day and month are " +
                              result);

            string numberToTest;

            Console.WriteLine("Please enter a float number");
            numberToTest = Console.ReadLine();

            String[] separator = { "," };
            String[] parts     = numberToTest.Split(separator, 2,
                                                    StringSplitOptions.RemoveEmptyEntries);

            int numOne, numTwo;

            numOne = (int)parts[1][0];
            numTwo = (int)parts[1][1];

            Console.WriteLine("{0},{1}", numOne, numTwo);

            int resultFloat = numOne + numTwo;

            Console.WriteLine("The result of the first two values after comma is " + resultFloat);

            Console.WriteLine("Please enter time in 24 hour format as integer");
            int    hourInput = System.Convert.ToInt32(Console.ReadLine());
            string greetings = ((0 <= hourInput) && (hourInput < 6)) ?
                               "Good night" :
                               ((6 <= hourInput) && (hourInput < 12)) ?
                               "Good morning":
                               ((12 <= hourInput) && (hourInput < 18)) ?
                               "Good afternoon":
                               "Good evening";

            Console.WriteLine(greetings);

            //Enum task
            TestCaseStatus test1Status = TestCaseStatus.Pass;

            Console.WriteLine(test1Status);
        }
        // Leaving in for possible future use
        private string createTestCasePostData(string testCaseRunId, TestCaseStatus status)
        {
            string postData =
                "<TestCaseruns>" +
                "<TestCaseRun>" +
                "<Id>" + testCaseRunId + "</Id>" +
                "<Status>" + status.ToString() + "</Status>" +
                "</TestCaseRun>" +
                "</TestCaseruns>";

            return(postData);
        }
예제 #11
0
 Color GetColor(TestCaseStatus status)
 {
     switch (status)
     {
         case TestCaseStatus.Unknown: return Color.Gray;
         case TestCaseStatus.Fail: return Color.FromArgb(255, 192, 192);
         case TestCaseStatus.Pass_Good: return Color.FromArgb(192, 255, 192);
         case TestCaseStatus.Pass_Acceptable: return Color.FromArgb(64, 255, 64);
         case TestCaseStatus.Ignore: return Color.FromArgb(255, 255, 192);
         default: return Color.DarkGray;
     }
 }
예제 #12
0
        public void ChangeStatus(string testCaseName, TestCaseStatus status)
        {
            TestCaseGroup from = testcasemap[testCaseName];
            TestCaseGroup to   = OtherTestCases;

            if (from == null)
            {
                return;
            }
            TestCase testcase = from.TestCaseList.FirstOrDefault(c => c.Name == testCaseName);

            if (status == TestCaseStatus.Running)
            {
                RunningTestCase = testcase;
            }
            switch (status)
            {
            case TestCaseStatus.Running:
                to = InProgressTestCases;
                break;

            case TestCaseStatus.Passed:
                testcase.IsChecked = false;
                to = PassedTestCases;
                break;

            case TestCaseStatus.Failed:
                testcase.IsChecked = true;
                to = FailedTestCases;
                break;

            case TestCaseStatus.Other:
                to = OtherTestCases;
                break;

            case TestCaseStatus.NotRun:
                to = NotRunTestCases;
                break;
            }

            testcase.Status = status;
            if (UpdateTestCaseStatus != null)
            {
                UpdateTestCaseStatus(from, to, testcase);
            }
            else
            {
                from.RemoveTestCase(testcase);
                to.AddTestCase(testcase);
            }
            testcasemap[testCaseName] = to;
        }
예제 #13
0
        public TestCaseStatus Show(TestCaseStatus initStatus, LayoutTestCase tcase, DW<Bitmap> bitmap)
        {
            lbFilename.Text = Path.GetFileName(tcase.Filename);
            lbPageNum.Text = tcase.PageNum.ToString();
            Comment = tcase.Comment;

            pbPage.Image = bitmap.o;
            Status = initStatus;

            ShowDialog();

            tcase.Comment = Comment;

            return Status;
        }
예제 #14
0
        static void Main(string[] args)
        {
            TestCaseStatus testStatus = TestCaseStatus.Pass;

            Console.WriteLine("Test status is {0}", testStatus);
            Console.ReadKey();
            RGB white, black;

            white.red   = 0;
            white.green = 0;
            white.blue  = 0;
            black.red   = 255;
            black.green = 255;
            black.blue  = 255;
        }
예제 #15
0
 /// <summary>
 /// Update the case status and case log
 /// Find the related case name, change its status and show log to user
 /// </summary>
 public void UpdateCaseFromHtmlLog(TestCaseStatus status, string testCaseName, TestCaseDetail detail, string testCaseLogPath)
 {
     RunningTestCase = AllTestCases.FirstOrDefault(c => c.Name == testCaseName);
     if (RunningTestCase == null)
     {
         return;
     }
     GroupByOutcome.ChangeStatus(testCaseName, status);
     RunningTestCase.LogUri          = new Uri(testCaseLogPath);
     RunningTestCase.Assembly        = detail.Source;
     RunningTestCase.StartTime       = detail.StartTime;
     RunningTestCase.EndTime         = detail.EndTime;
     RunningTestCase.StdOut          = String.Join("\n", detail.StandardOut.Select(output => output.Content));
     RunningTestCase.ErrorMessage    = String.Join("\n", detail.ErrorMessage);
     RunningTestCase.ErrorStackTrace = String.Join("\n", detail.ErrorStackTrace);
     RunningTestCase = null;
 }
예제 #16
0
        static void Main(string[] args)
        {
            TestCaseStatus test1Status = TestCaseStatus.Pass;

            Console.WriteLine(test1Status);

            RGB white, black;

            white.red   = 255;
            white.green = 255;
            white.blue  = 255;
            black.red   = 255;
            black.green = 255;
            black.blue  = 255;

            Console.ReadKey();
        }
예제 #17
0
 public override void init(TestCaseStatus status)
 {
     //编写前置条件
     //判断该Id的控件是否存在
     if (TC.android.isExit2(objectID))
     {
         //加载页面中其它元素
         List.Add("提示文字", TC.android.driver.FindElementById("com.aliyun.mobile.permission:id/mc_pm_textView"));
         List.Add("单选按钮", TC.android.driver.FindElementById("com.aliyun.mobile.permission:id/mc_pm_check"));
         List.Add("拒绝按钮", TC.android.driver.FindElementById("android:id/button2"));
         List.Add("允许按钮", TC.android.driver.FindElementById("android:id/button1"));
         //存在
         base.init(status);
     }
     else
     {
     }
 }
        public override void init(TestCaseStatus status)
        {
            //编写前置条件
            //判断该Id的控件是否存在
            if(TC.android.isExit2(objectID))
            {
                //加载页面中其它元素
                List.Add("提示文字",TC.android.driver.FindElementById("com.aliyun.mobile.permission:id/mc_pm_textView"));
                List.Add("单选按钮", TC.android.driver.FindElementById("com.aliyun.mobile.permission:id/mc_pm_check"));
                List.Add("拒绝按钮", TC.android.driver.FindElementById("android:id/button2"));
                List.Add("允许按钮", TC.android.driver.FindElementById("android:id/button1"));
                //存在
                base.init(status);
            }
            else
            {

            }
            
        }
        public void ChangeStatus(string testCaseName, TestCaseStatus status)
        {
            TestCaseGroup from = testcasemap[testCaseName];
            TestCaseGroup to = OtherTestCases;
            if (from == null) return;
            TestCase testcase = from.TestCaseList.FirstOrDefault(c => c.Name == testCaseName);
            if (status == TestCaseStatus.Running) RunningTestCase = testcase;
            switch (status)
            {
                case TestCaseStatus.Running:
                    to = InProgressTestCases;
                    break;
                case TestCaseStatus.Passed:
                    testcase.IsChecked = false;
                    to = PassedTestCases;
                    break;
                case TestCaseStatus.Failed:
                    testcase.IsChecked = true;
                    to = FailedTestCases;
                    break;
                case TestCaseStatus.Other:
                    to = OtherTestCases;
                    break;
                case TestCaseStatus.NotRun:
                    to = NotRunTestCases;
                    break;
            }

            testcase.Status = status;
            if (UpdateTestCaseStatus != null)
            {
                UpdateTestCaseStatus(from, to, testcase);
            }
            else
            {

                from.RemoveTestCase(testcase);
                to.AddTestCase(testcase);
            }
            testcasemap[testCaseName] = to;
        }
예제 #20
0
        public void DisplayTestResult(string caseId, TestCaseStatus status)
        {
            Color color = System.Drawing.Color.Black;

            switch (status)
            {
            case TestCaseStatus.Green:
                color = Color.Green;
                break;

            case TestCaseStatus.Red:
                color = Color.Red;
                break;

            case TestCaseStatus.Yellow:
                color = Color.DarkOrchid;
                break;
            }

            if (_tcNodes.ContainsKey(caseId))
            {
                _tcNodes[caseId].ForeColor = color;
            }
        }
예제 #21
0
        static void Main(string[] args)
        {
            #region Tasks

            #region Task 1
            int day, month;
            Console.Write("Enter day number: ");
            day = Convert.ToInt32(Console.ReadLine());
            Console.Write("Enter month number: ");
            month = Convert.ToInt32(Console.ReadLine());
            if (day < 31 && month < 12)
            {
                Console.WriteLine("True");
            }
            else
            {
                Console.WriteLine("False");
            }
            #endregion

            #region Task 2
            Console.Write("Enter number: ");
            double num  = Convert.ToDouble(Console.ReadLine());
            double buf  = (num - (int)num) * 10;
            int    num1 = (int)buf;
            int    num2 = (int)((buf - num1) * 10);
            Console.WriteLine("{0}+{1}={2}", num1, num2, num1 + num2);
            #endregion

            #region Task 3
            int hour = Convert.ToInt32(Console.ReadLine());
            if (hour >= 4 && hour < 11)
            {
                Console.WriteLine("Good Morning!");
            }
            if (hour >= 11 && hour < 16)
            {
                Console.WriteLine("Good Day!");
            }
            if (hour >= 16 && hour < 22)
            {
                Console.WriteLine("Good Evening!");
            }
            if ((hour >= 22 && hour < 24) || (hour >= 0 && hour < 4))
            {
                Console.WriteLine("Good Morning!");
            }
            #endregion

            #region Task 4

            TestCaseStatus test1Status = TestCaseStatus.Pass;
            if (test1Status == TestCaseStatus.Pass)
            {
                Console.WriteLine("Passed");
            }

            #endregion

            #region Task 5
            #endregion


            #endregion

            #region HomeWork

            #region Task A
            double f_num1, f_num2, f_num3;
            Console.Write("Enter first number: ");
            f_num1 = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter second number: ");
            f_num2 = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter third number: ");
            f_num3 = Convert.ToDouble(Console.ReadLine());

            if (f_num1 >= -5 && f_num1 <= 5)
            {
                Console.WriteLine("{0} - True", f_num1);
            }
            if (f_num2 >= -5 && f_num2 <= 5)
            {
                Console.WriteLine("{0} - True", f_num2);
            }
            if (f_num3 >= -5 && f_num3 <= 5)
            {
                Console.WriteLine("{0} - True", f_num3);
            }
            #endregion
            #region Task B
            int i_num1, i_num2, i_num3;
            Console.Write("Enter first number: ");
            i_num1 = Convert.ToInt32(Console.ReadLine());
            Console.Write("Enter second number: ");
            i_num2 = Convert.ToInt32(Console.ReadLine());
            Console.Write("Enter third number: ");
            i_num3 = Convert.ToInt32(Console.ReadLine());
            if (i_num2 > i_num1)
            {
                if (i_num3 > i_num2)
                {
                    Console.WriteLine("Max = {0}", i_num3);
                }
                else
                {
                    Console.WriteLine("Max = {0}", i_num2);
                }
            }
            else
            {
                Console.WriteLine("Max = {0}", i_num1);
            }
            if (i_num2 < i_num1)
            {
                if (i_num3 < i_num2)
                {
                    Console.WriteLine("Min = {0}", i_num3);
                }
                else
                {
                    Console.WriteLine("Min = {0}", i_num2);
                }
            }
            else
            {
                Console.WriteLine("Min = {0}", i_num1);
            }
            #endregion
            #region Task C
            HTTPError h = HTTPError.e401;
            if (h == HTTPError.e401)
            {
                Console.WriteLine("Error 401");
            }
            #endregion

            #region Task D
            Dog d = new Dog();
            d.Name = Console.ReadLine();
            d.Mark = Console.ReadLine();;
            d.Age  = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine(d._toString());
            #endregion
            #endregion
        }
예제 #22
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">Name of the test case</param>
 /// <param name="status">The status of the test case</param>
 public CaseListItem(string name, TestCaseStatus status)
 {
     Name = name;
     Outcome = status == TestCaseStatus.Other ? "Inconclusive" : status.ToString();
 }
예제 #23
0
 public void DisplayTestResult(string caseId, TestCaseStatus status)
 {
     BeginInvoke(new Action(() => { testsTree.DisplayTestResult(caseId, status); }));
 }
예제 #24
0
        static void Main(string[] args)
        {
            // Identify enum TestCaseStatus (Pass, Fail, Blocked, WP, Unexecuted).
            //  Assign status “Pass” for the variable  test1Status and print the value of the variable console.
            TestCaseStatus test1Status = TestCaseStatus.Pass;

            Console.WriteLine(test1Status);

            // read number of HTTP Error (400, 401,402, ...) and write the name
            //  of this error (Declare enum HTTPError)

            Console.WriteLine("Enter number of error: ");
            int er = int.Parse(Console.ReadLine());

            switch (er)
            {
            case 400:
                Console.WriteLine(HTTPError.BadRequest);
                break;

            case 401:
                Console.WriteLine(HTTPError.Unauthorized);
                break;

            case 402:
                Console.WriteLine(HTTPError.PaymentRequired);
                break;

            case 403:
                Console.WriteLine(HTTPError.Forbidden);
                break;

            default:
                Console.WriteLine(HTTPError.BadRequest);
                break;
            }

            // read 3 float numbers and check: are they all belong to the range [-5,5].
            int a = -5;
            int b = 5;

            Console.WriteLine("Enter 3 numbers");
            float number  = float.Parse(Console.ReadLine());
            float number1 = float.Parse(Console.ReadLine());
            float number2 = float.Parse(Console.ReadLine());
            bool  answer  = false;

            if (number <= b && number >= a)
            {
                if (number1 >= a && number1 <= b)
                {
                    if (number2 >= a && number2 <= b)
                    {
                        Console.WriteLine($"All numbers are in [{a},{b}] ");
                        answer = true;
                    }
                }
            }
            if (!answer)
            {
                Console.WriteLine($"Not all numbers are in [{a},{b}]  ");
            }

            // read 3 integers and write max and min of them.
            Console.WriteLine("\nEnter n and numbers");
            int n = int.Parse(Console.ReadLine());

            int [] nums = new int[n];
            for (int i = 0; i < n; i++)
            {
                nums[i] = int.Parse(Console.ReadLine());
            }
            int max = nums[0];
            int min = nums[0];

            for (int i = 0; i < n; i++)
            {
                if (nums[i] > max)
                {
                    max = nums[i];
                }
                if (nums[i] < min)
                {
                    min = nums[i];
                }
            }
            Console.WriteLine($"min={min}, max={max}");

            // declare struct Dog with fields Name, Mark, Age. Declare variable
            //  myDog of Dog type and read values for it. Output myDos into console.
            //  (Declare method ToString in struct)

            Dog myDog;

            myDog.Name = "Alex";
            myDog.Mark = "Gaff";
            myDog.Age  = 110;
            Console.WriteLine(myDog.ToString());

            RGB rgb_black;

            rgb_black.blue  = 0;
            rgb_black.green = 0;
            rgb_black.red   = 0;
            rgb_black.Info();

            RGB rgb_white;

            rgb_white.red   = 255;
            rgb_white.blue  = 255;
            rgb_white.green = 255;
            rgb_white.Info();

            //Enter two integers numbers and check if they can represent the day and month. Print true or false.

            Console.WriteLine("\nEnter 2 int numbers for month/day task");
            int  first  = int.Parse(Console.ReadLine());
            int  second = int.Parse(Console.ReadLine());
            bool rez    = ((first <= 31 && first >= 1) || (second <= 31 && second >= 1)) &&
                          ((second >= 1 && second <= 12) || (first >= 1 && first <= 12));

            Console.WriteLine(rez.ToString());


            // Enter double  number  and get the first 2 digits after the point
            //  of this number and output the sum of these numbers. For example: 3.456 -> 4+5=9

            Console.WriteLine("\nDouble number task");
            double dblNumber = double.Parse(Console.ReadLine());

            dblNumber *= 100;
            dblNumber  = Math.Floor(dblNumber);
            dblNumber %= 100;
            int temp = (int)dblNumber / 10 + (int)dblNumber % 10;

            Console.WriteLine($"sum is:{temp}");

            // Enter integer number h, representing the time of day (hour).
            //  Depending on the time of day, print greetings ("Good morning!",
            //  "Good afternoon!", "Good evening!", "Good night!")

            Console.WriteLine("\n Hour task. Enter h");
            int h = int.Parse(Console.ReadLine());

            if (h >= 6 && h < 11)
            {
                Console.WriteLine("Good morning!");
            }
            else if (h >= 11 && h < 18)
            {
                Console.WriteLine("Good afternoon!");
            }
            else if (h >= 18 && h < 21)
            {
                Console.WriteLine("Good evening!");
            }
            else if (h >= 21 && h < 6)
            {
                Console.WriteLine("Good night!");
            }
            else
            {
                Console.WriteLine("Hello");
            }
        }
예제 #25
0
        public override void init(TestCaseStatus status)
        {
            //编写前置条件

            base.init(status);
        }
예제 #26
0
        public void IntroductionHW2()
        {
            // Define integer variables a and b.Read values a and b from Console and calculate: a + b, a - b, a* b, a/ b.Output obtained results.
            int a, b;

            a = Convert.ToInt32(Console.ReadLine());
            b = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("a = {0}\tb = {1}", a, b);
            Console.WriteLine("a + b = {0}", a + b);
            Console.WriteLine("a - b = {0}", a - b);
            Console.WriteLine("a * b = {0}", a * b);
            if (a == 0)
            {
                Console.WriteLine("a / b =  incorrect");
            }
            else
            {
                Console.WriteLine("a / b = {0}", a / b);
            }

            // Output question “How are you ?“. Define string variable answer.Read the value answer and output: “You are(answer)".
            Console.WriteLine("How are you ?");
            string txt = Console.ReadLine();

            Console.WriteLine("You are(answer){0}", txt);
            // Read 3 variables of char type. Write message: “You enter(first char), (second char), (3 char)”
            char z, x, c;

            z = Console.ReadKey().KeyChar;
            x = Console.ReadKey().KeyChar;
            c = Console.ReadKey().KeyChar;
            Console.WriteLine("You enter{0}, {1}, {2}", z, x, c);
            // Enter 2 integer numbers. Check if they are both positive – use bool expretion
            Console.WriteLine("a = {0}", a > 0 ? "positive" : "negateive");
            Console.WriteLine("b = {0}", b > 0 ? "positive" : "negateive");

            //Ввести дійсне число number і отримати 2 перші цифри після коми цього числа. Вивести суму цих цифр. Напр.: 3.456->4 + 5 = 9


            float val;

            if (float.TryParse(Console.ReadLine(), out val))
            {
                string[] tmp = val.ToString().Split(',');

                if (tmp.Length > 1)
                {
                    if (tmp[1].Length > 1)
                    {
                        Console.WriteLine(tmp[1][0] + " - " + tmp[1][1]);
                        Console.WriteLine("sum = {0}", Int32.Parse(tmp[1][0].ToString()) + Int32.Parse(tmp[1][1].ToString()));
                    }
                }
            }
            else
            {
                Console.WriteLine("Wrong input data");
            }



            TestCaseStatus test1Status = TestCaseStatus.Fail;

            Console.WriteLine("{0} = taste1Status ", test1Status);

            Dog myDog;

            myDog.Age  = 3;
            myDog.Mark = "Bulgog";
            myDog.Name = "Admiral";
            Console.WriteLine(myDog);

            Console.ReadKey();
        }
예제 #27
0
 private Color GetDataGridRowColor(TestCaseStatus testCaseStatus)
 {
     switch (testCaseStatus)
     {
         case TestCaseStatus.Untested:
             return Color.LightGray;
         case TestCaseStatus.Running:
             return Color.Yellow;
         case TestCaseStatus.Error:
             return Color.Orange;
         case TestCaseStatus.Failed:
             return Color.Red;
         case TestCaseStatus.Succeed:
             return Color.LightGreen;
         default:
             return Color.LightGray;
     }
 }
예제 #28
0
        public override void init(TestCaseStatus status)
        {
            //编写前置条件

            base.init(status);
        }
예제 #29
0
        /// <summary>
        /// Parse the file content to get the case status
        /// Result format in file: "Result":"Result: Passed"
        /// </summary>
        public static bool ParseFileGetStatus(string filePath, out TestCaseStatus status)
        {
            status = TestCaseStatus.NotRun;

            string content = File.ReadAllText(filePath);
            int startIndex = content.IndexOf(AppConfig.ResultKeyword);
            startIndex += AppConfig.ResultKeyword.Length;
            int endIndex = content.IndexOf("\"", startIndex);
            string statusStr = content.Substring(startIndex, endIndex - startIndex);
            switch (statusStr)
            {
                case AppConfig.HtmlLogStatusPassed:
                    status = TestCaseStatus.Passed;
                    break;
                case AppConfig.HtmlLogStatusFailed:
                    status = TestCaseStatus.Failed;
                    break;
                case AppConfig.HtmlLogStatusInconclusive:
                    status = TestCaseStatus.Other;
                    break;
                default:
                    // The file name format is not correct
                    return false;
            }

            return true;
        }
        public void ChangeStatus(string testCaseName, TestCaseStatus status)
        {
            TestCaseGroup from = testcasemap[testCaseName];
            TestCaseGroup to = OtherTestCases;
            if (from == null) return;
            TestCase testcase = from.TestCaseList.FirstOrDefault(c => c.Name == testCaseName);
            // If changed to Running/Waiting status, no need to change group.
            if (status == TestCaseStatus.Running)
            {
                if (RunningTestCase != null)
                {
                    if (RunningTestCase.Status == TestCaseStatus.Running)
                        RunningTestCase.Status = TestCaseStatus.Waiting;
                }
                RunningTestCase = testcase;
                RunningTestCase.Status = status;
                if(UpdateTestCaseList != null)
                {
                    UpdateTestCaseList(from, RunningTestCase);
                }
                return;
            }
            if (status == TestCaseStatus.Waiting)
            {
                if (testcase.Status == TestCaseStatus.Running)
                {
                    testcase.Status = status;
                    return;
                }
            }

            switch (status)
            {
                case TestCaseStatus.Passed:
                    testcase.IsChecked = false;
                    to = PassedTestCases;
                    break;
                case TestCaseStatus.Failed:
                    testcase.IsChecked = true;
                    to = FailedTestCases;
                    break;
                case TestCaseStatus.Other:
                    to = OtherTestCases;
                    break;
                case TestCaseStatus.NotRun:
                    to = NotRunTestCases;
                    break;
            }
            testcase.Status = status;
            if (UpdateTestCaseStatus != null)
            {
                UpdateTestCaseStatus(from, to, testcase);
            }
            else
            {

                from.RemoveTestCase(testcase);
                to.AddTestCase(testcase);
            }
            testcasemap[testCaseName] = to;
        }
예제 #31
0
        static void Main(string[] args)
        {
            Console.Write("Enter number of day: ");
            int day = Convert.ToInt32(Console.ReadLine());

            Console.Write("Enter number of month: ");
            int month = Convert.ToInt32(Console.ReadLine());

            bool isNumbersRepresentDayAndMonth = ((0 < day) && (day <= 31)) && ((0 < month) && (month <= 12));

            Console.WriteLine("\nEntered numbers can represent the day and month: " + isNumbersRepresentDayAndMonth);

            Console.Write("Enter double number: ");
            double number = Convert.ToDouble(Console.ReadLine());
            double fractionalPartOfNumber = number - Math.Floor(number);
            int    firstNumberAfterPoint  = Convert.ToInt32(Math.Floor(fractionalPartOfNumber * 10));
            int    secondNumberAfterPoint = Convert.ToInt32(Math.Floor(fractionalPartOfNumber * 100) % 10);
            int    sumOfNumbersAfterPoint = firstNumberAfterPoint + secondNumberAfterPoint;

            Console.WriteLine("\nSum of first and second number after point: {0} + {1} = {2}", firstNumberAfterPoint, secondNumberAfterPoint, sumOfNumbersAfterPoint);

            Console.Write("\nEnter the time of day(in hours): ");
            int h = Convert.ToInt32(Console.ReadLine());

            if (h < 0)
            {
                Console.WriteLine("\nIncorrect!");
            }
            else if (h < 6)
            {
                Console.WriteLine("\nGood night!");
            }
            else if (h < 12)
            {
                Console.WriteLine("\nGood morning!");
            }
            else if (h < 18)
            {
                Console.WriteLine("\nGood afternoon!");
            }
            else if (h < 24)
            {
                Console.WriteLine("\nGood evening!");
            }
            else
            {
                Console.WriteLine("\nIncorrect!");
            }

            TestCaseStatus test1Status = TestCaseStatus.Pass;

            Console.WriteLine("\nTest case status : " + test1Status);

            RGB white;

            white.red   = 0;
            white.blue  = 0;
            white.green = 0;

            RGB black;

            black.red   = 255;
            black.blue  = 255;
            black.green = 255;
        }
예제 #32
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">Name of the test case</param>
 /// <param name="status">The status of the test case</param>
 public CaseListItem(string name, TestCaseStatus status)
 {
     Name    = name;
     Outcome = status == TestCaseStatus.Other ? "Inconclusive" : status.ToString();
 }
예제 #33
0
        static void Main(string[] args)
        {
            //Task2.1
            //Enter two integers numbers and check if they can represent the day and month.
            //Print true or false.
            Console.WriteLine("Enter two number: ");
            int  day   = Convert.ToInt32(Console.ReadLine());
            int  month = Convert.ToInt32(Console.ReadLine());
            bool canRepresentDayAndMonth = (day <= 31 & month <= 12 & day > 0 & month > 0);

            Console.WriteLine($"can represent the day and month? - {canRepresentDayAndMonth}");

            //Task2.2
            //Enter double  number  and get the first 2 digits after the point of this
            //number and output the sum of these numbers. For example: 3.456 -> 4+5=9
            Console.WriteLine("Enter double number");
            double number     = Convert.ToDouble(Console.ReadLine());
            double remainder  = Math.Floor(number);                //Rounded to the bottom so as not to change the value of the integer
            double afterPoint = Math.Round(number - remainder, 3); //3 numbers after point

            Console.WriteLine("Befor point " + remainder);
            Console.WriteLine("After point " + afterPoint);
            int afterPointDigits = Convert.ToInt32(Math.Floor(afterPoint * 100));//multiply and cut digit after point

            Console.WriteLine("After poin after rounded " + afterPointDigits);

            int getSum(int n)
            {
                int sumOfDigits = 0;

                while (n != 0)
                {
                    sumOfDigits = sumOfDigits + n % 10;
                    n           = n / 10;
                }
                return(sumOfDigits);
            }

            Console.WriteLine("Sum of first 2 didgits after the point = " + getSum(afterPointDigits));


            //Task2.3
            //Enter integer number h, representing the time of day (hour).
            //Depending on the time of day, print greetings (
            //"Good morning!", "Good afternoon!", "Good evening!", "Good night!")
            Console.WriteLine("Enter current hour");
            int hour = Convert.ToInt32(Console.ReadLine());

            if (6 <= hour & hour < 12)
            {
                Console.WriteLine("Good Morning");
            }
            else if (12 < hour & hour < 18)
            {
                Console.WriteLine("Good Afternoon");
            }
            else if (18 < hour & hour < 21)
            {
                Console.WriteLine("Good evening");
            }
            else if (18 < hour & hour < 24 ^ hour < 6)
            {
                Console.WriteLine("Good Night");
            }
            //Task2.4
            //Identify enum TestCaseStatus (Pass, Fail, Blocked, WP, Unexecuted).
            //Assign status “Pass” for the variable  test1Status and print the
            //value of the variable console.
            TestCaseStatus test1Status = TestCaseStatus.Pass;

            Console.WriteLine($"test1Status - {test1Status}");



            //Task2.5
            //Determine RGB structure that represents the color with fields red, green, blue (type byte).
            //Identify two variables of this type and enter their fields for white and black colors
            RGB black = new RGB();

            black.red   = 0;
            black.green = 0;
            black.blue  = 0;
            black.info("black");

            RGB white = new RGB();

            white.blue  = 255;
            white.green = 255;
            white.red   = 255;
            white.info("white");
        }
예제 #34
0
 /// <summary>
 /// Update the case status and case log
 /// Find the related case name, change its status and show log to user
 /// </summary>
 public void UpdateCaseFromHtmlLog(TestCaseStatus status, string testCaseName, string testCaseLogPath)
 {
     RunningTestCase = AllTestCases.FirstOrDefault(c => c.Name == testCaseName);
     if (RunningTestCase == null) return;
     GroupByOutcome.ChangeStatus(testCaseName, status);
     RunningTestCase.LogUri = new Uri(testCaseLogPath);
     RunningTestCase = null;
 }
        public void ChangeStatus(string testCaseName, TestCaseStatus status)
        {
            TestCaseGroup from = testcasemap[testCaseName];
            TestCaseGroup to   = OtherTestCases;

            if (from == null)
            {
                return;
            }
            TestCase testcase = from.TestCaseList.FirstOrDefault(c => c.Name == testCaseName);

            // If changed to Running/Waiting status, no need to change group.
            lock (locker)
            {
                if (status == TestCaseStatus.Running)
                {
                    if (RunningTestCase != null)
                    {
                        if (RunningTestCase.Status == TestCaseStatus.Running)
                        {
                            RunningTestCase.Status = TestCaseStatus.Waiting;
                        }
                    }
                    RunningTestCase        = testcase;
                    RunningTestCase.Status = status;
                    if (UpdateTestCaseList != null)
                    {
                        UpdateTestCaseList(from, RunningTestCase);
                    }
                    return;
                }
                if (status == TestCaseStatus.Waiting)
                {
                    if (testcase.Status == TestCaseStatus.Running)
                    {
                        testcase.Status = status;
                        return;
                    }
                }

                switch (status)
                {
                case TestCaseStatus.Passed:
                    testcase.IsChecked = false;
                    to = PassedTestCases;
                    break;

                case TestCaseStatus.Failed:
                    testcase.IsChecked = true;
                    to = FailedTestCases;
                    break;

                case TestCaseStatus.Other:
                    to = OtherTestCases;
                    break;

                case TestCaseStatus.NotRun:
                    to = NotRunTestCases;
                    break;
                }
                testcase.Status = status;
                if (UpdateTestCaseStatus != null)
                {
                    UpdateTestCaseStatus(from, to, testcase);
                }
                else
                {
                    from.RemoveTestCase(testcase);
                    to.AddTestCase(testcase);
                }
                testcasemap[testCaseName] = to;
            }
        }