Ejemplo n.º 1
0
        private void showAmericanQuestion()
        {
            textBoxAnsw.Hide();
            q = AmericanQuestion[i_American];
            var y = 0;

            labelQues.Text = q.QuestionText.ToString();
            AnswersList    = BL.GetAnswers(q.ID);
            AnswersgroupBox.Show();
            AnswersgroupBox.Controls.Clear();

            foreach (var answer in AnswersList)
            {
                RadioButton newRadio = new RadioButton();
                newRadio.Text     = answer.AnswerValue.ToString();
                newRadio.Font     = new Font("Microsoft YaHei UI", 18);
                newRadio.Location = new Point(0, y);
                AnswersgroupBox.Controls.Add(newRadio);
                y += 30;
            }
            i_American++;
        }
Ejemplo n.º 2
0
        private void buttonNext_Click(object sender, EventArgs e)
        {
            CheckAns();
            if (err == 1)
            {
                error.Text = "עליך להקיש ספרות";
                AnswersgroupBox.Hide();
                q = Question[i_Simple - 1];
                labelQues.Text = q.QuestionText;
                err            = 0;
                return;
            }
            error.Text = "";
            if (AmericanQuestion.Count() > i_American)
            {
                textBoxAnsw.Hide();
                showAmericanQuestion();
            }
            else
            {
                textBoxAnsw.Show();
                textBoxAnsw.Text = "";

                if (Question.Count() > i_Simple)
                {
                    showSimpleQuestion();
                }
                else
                {
                    BL.EndTest(points);
                    End end = new End();
                    this.Hide();
                    end.Show();
                }
                return;
            }
        }
Ejemplo n.º 3
0
        public void OrderProductsTest()
        {
            var productCodes = new string[]
            {
                "Can",
                "1",
                "Be",
                "Sure",
                "2",
                "Output",
                "a",
                "List",
                "In",
                "Order"
            };

            var expectedHigh = new HashSet <string>()
            {
                "Output", "a", "In", "Order"
            };
            var expectedMedium = new HashSet <string>()
            {
                "1", "2"
            };

            var questions = new Questions();

            questions.OrderProductsByPriority(productCodes);

            var currentPriority = 1; // expect to start with high

            foreach (var productCode in productCodes)
            {
                // move to the next priority if we've hit a boundary
                currentPriority = currentPriority switch
                {
                    1 when !expectedHigh.Contains(productCode) => 2,
                    2 when !expectedMedium.Contains(productCode) => 3,
                    _ => currentPriority
                };

                // and make sure that the priorities are what we expected
                switch (currentPriority)
                {
                case 1:
                    expectedHigh.Should().Contain(productCode);
                    expectedMedium.Should().NotContain(productCode);
                    break;

                case 2:
                    expectedHigh.Should().NotContain(productCode);
                    expectedMedium.Should().Contain(productCode);
                    break;

                default:
                    expectedHigh.Should().NotContain(productCode);
                    expectedMedium.Should().NotContain(productCode);
                    break;
                }
            }
        }
    }
        public void GenerateLowestNumberTest(string number, int n, string expected)
        {
            var result = Questions.GenerateLowestNumber(number, n);

            result.Should().Be(expected);
        }