示例#1
0
        static void Main()
        {
            int num;

            Console.WriteLine("请输入一个整数:");
            num = Convert.ToInt32(Console.ReadLine());
            Factorial n = new Factorial();
            int       result;

            result = n.Execute(num);
            Console.WriteLine(result);
            Console.ReadLine();
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            int num = Convert.ToInt32(txtdg.Text);

            Stopwatch sw = new Stopwatch();

            sw.Restart();

            Factorial factorial = new Factorial(num);

            txtRs.Text = factorial.ToString();

            sw.Stop();
            labMsg.Text = "耗时:" + sw.Elapsed.TotalSeconds.ToString();
        }
示例#3
0
        public void ZeroFactorial_Test()
        {
            Factorial factorial = new Factorial();

            Assert.AreEqual(0, factorial.compute(0));
        }
示例#4
0
        public void TwoFactorial_Test()
        {
            Factorial factorial = new Factorial();

            Assert.AreEqual(2, factorial.compute(2));
        }
示例#5
0
        public void OneFactorial_Test()
        {
            Factorial factorial = new Factorial();

            Assert.AreEqual(1, factorial.compute(1));
        }