Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var rep = true;

            do
            {
                Console.WriteLine("Choose task:\n1)Arrays merging\n2)Searching for duplicate\n3)Palindrome count");
                var choose = int.Parse(Console.ReadLine());
                Console.WriteLine();

                if (choose == 1)
                {
                    var task = new FirstTask();
                    task.Do();
                }
                if (choose == 2)
                {
                    var task = new SecondTask();
                    task.Do();
                }
                if (choose == 3)
                {
                    var task = new ThirdTask();
                    task.Do();
                }

                Console.WriteLine("\nMore tasks?(y/n)");
                char r = char.Parse(Console.ReadLine());
                if (r == 'n')
                {
                    rep = false;
                }
            } while (rep);
        }
        public void InsertNumberTestCorrectInput(int numberSource, int numberIn, int startingBitPosition, int endingBitPosition, int expectedResult)
        {
            // Run the method under test
            var actualResult = FirstTask.InsertNumber(numberSource, numberIn, startingBitPosition, endingBitPosition);

            // Verify the result:
            Assert.AreEqual(expectedResult, actualResult);
        }
Exemplo n.º 3
0
        public void RunsFirstExample()
        {
            var run = FirstTask.Run(5, 2, new List <string> {
                "1", "2", "1", "3", "5"
            });

            Assert.AreEqual(16, run);
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSingleTaskContentType() throws org.codehaus.jettison.json.JSONException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testSingleTaskContentType()
        {
            // get id of first task
            string taskId = FirstTask.getString("id");

            string resourcePath = APP_BASE_PATH + TASK_PATH + "/" + taskId;

            log.info("Checking " + resourcePath);
            assertMediaTypesOfResource(resourcePath, false);
        }
    private void Application_Startup(object sender, StartupEventArgs e)
    {
        BackgroundWorker backWorker = new BackgroundWorker();

        backWorker.DoWork             += new DoWorkEventHandler(backWorker_DoWork);
        backWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backWorker_RunWorkerCompleted);
        backWorker.RunWorkerAsync();
        MainWindow mainWindow = new MainWindow();

        firstTask = new FirstTask();
        firstTask.ShowDialog();
        mainWindow.Show();
    }
Exemplo n.º 6
0
        public void Factorial_5_240returned()
        {
            // arrange
            int x        = 5;
            int expected = 240;

            // act
            FirstTask c      = new FirstTask();
            int       actual = c.Method(x);

            // assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 7
0
 public void InitTaskList()
 {
     for (int i = 0; i < 10; i++)
     {
         TaskBase task = new FirstTask();
         task.taskInfo.Id          = i;
         task.taskInfo.Name        = "Name" + i;
         task.taskInfo.IconName    = "IconName" + i;
         task.taskInfo.Describe    = "Describe" + i;
         task.taskInfo.CurrState   = ETaskState.NonTriggered;
         task.taskInfo.TriggerMode = ETaskTriggerMode.Auto;
         task.Init();
         allTaskList.Add(task);
     }
 }
Exemplo n.º 8
0
        protected override void OnStart(string[] args)
        {
            this.RequestAdditionalTime(30000);

            InitializeService();

            CancellationToken token = _cancellationTokenSource.Token;

            Task.Run(() => FirstTask.Do(token, 5));
            Task.Run(() => SecondTask.Do(token, 5));
            Task.Run(() => ThirdTask.Do(token, 10));
            Task.Run(() => BoothAvailabilityTask.Do(token, 10));
            Task.Run(() => PrintTask.Do(token, 10));
            Task.Run(() => ArchiveUploaderTask.Do(token, 10));
            Task.Run(() => InstagramSearchTask.Do(token, 60));
        }
Exemplo n.º 9
0
        private static void Main()
        {
            Console.WriteLine("Практичнi завдання");

            while (!IsTestingFinished)
            {
                Console.WriteLine("Виберiть подальшi дiї \n" +
                                  "1 - Перевiрити перше завдання\n" +
                                  "2 - Перевiрити друге завдання\n" +
                                  "3 - Перевiрити третє завдання\n" +
                                  "0 - Завершити перевiрку\n" +
                                  "clear - Очистити консоль\n");

                string index = Console.ReadLine();

                switch (index)
                {
                case "1":
                    Console.Clear();
                    FirstTask.Check();
                    break;

                case "2":
                    Console.Clear();
                    SecondTask.Check();
                    break;

                case "3":
                    Console.Clear();
                    ThirdTask.Check();
                    break;

                case "0":
                    IsTestingFinished = true;
                    break;

                case "clear":
                    Console.Clear();
                    break;

                default:
                    Console.WriteLine("Немає такого варiанту!");
                    break;
                }
            }
        }
Exemplo n.º 10
0
        protected override void OnStart(string[] args)
        {
            InitializeService();

            CancellationToken token = _cancellationTokenSource.Token;

            Task.Run(() => FirstTask.Do(token, 5));
            Task.Run(() => SecondTask.Do(token, 5));
            Task.Run(() => ThirdTask.Do(token, 10));
            Task.Run(() => BoothAvailabilityTask.Do(token, 10));
            Task.Run(() => PrintTask.Do(token, 10));
            Task.Run(() => ArchiveUploaderTask.Do(token, 10));

            while (!token.IsCancellationRequested)
            {
            }
        }
Exemplo n.º 11
0
        public void FirstTaskTest()
        {
            var ft = new FirstTask(10, 10);

            Assert.AreEqual(
                ft.CalcIntersectionCustom(new[] { 0, 4, 6, 9, 10 }, new[] { 0, 1, 3, 5, 8, 9, 11 }),
                new[] { 0, 9 }
                );

            Assert.AreEqual(
                ft.CalcIntersectionCustom(new[] { 0, 0, 3, 3, 11 }, new[] { 0, 1, 3, 5, 8, 9, 11 }),
                new[] { 0, 3, 11 }
                );

            Assert.AreEqual(
                ft.CalcIntersectionCustom(new[] { 0, 4, 6, 9, 10, 12 }, new[] { 0, 12 }),
                new[] { 0, 12 }
                );
        }
 public void InsertNumberTestStartingBitPositionIsGreaterThanEndingBitPosition(int numberSource, int numberIn, int startingBitPosition, int endingBitPosition)
 {
     // Run the method under test
     Assert.ThrowsException <ArgumentException>(() =>
                                                FirstTask.InsertNumber(numberSource, numberIn, startingBitPosition, endingBitPosition));
 }
 public void InsertNumberTestIncorrectInput(int numberSource, int numberIn, int startingBitPosition, int endingBitPosition)
 {
     // Run the method under test
     Assert.ThrowsException <ArgumentOutOfRangeException>(() =>
                                                          FirstTask.InsertNumber(numberSource, numberIn, startingBitPosition, endingBitPosition));
 }
Exemplo n.º 14
0
        public void Run2()
        {
            var run = FirstTask.Run(2, 4, ParseExample("105 19"));

            Assert.AreEqual(800 + 90 + 80 + 4, run);
        }
Exemplo n.º 15
0
        public void Run1()
        {
            var run = FirstTask.Run(2, 2, ParseExample("189 19"));

            Assert.AreEqual(800 + 80, run);
        }
Exemplo n.º 16
0
        public void RunsSecondExample()
        {
            var run = FirstTask.Run(3, 1, ParseExample("99 5 85"));

            Assert.AreEqual(10, run);
        }
 public ValuesController(FirstTask firstTask)
 {
     _task = firstTask;
 }
 public double FindNthRootTest(double a, double n, double accuracy)
 {
     return(FirstTask.FindNthRoot(a, n, accuracy));
 }
Exemplo n.º 19
0
        public void RunsThridExample()
        {
            var run = FirstTask.Run(1, 11, ParseExample("9999"));

            Assert.AreEqual(0, run);
        }
 public void FindNthRoot_NegativeInput_ThrowsArgumentOutOfRangeException(
     double number, int degree, double precision) =>
 Assert.Throws <ArgumentOutOfRangeException>(() => FirstTask.FindNthRoot(number, degree, precision));
Exemplo n.º 21
0
 static void Main()
 {
     FirstTask.Run();
     SecondTask.Run();
     ThirdTask.Run();
 }