public void Given_Rectangle_null_When_ComputeArea_Then_NullReferenceException()
        {
            Rectangle          input     = null;
            RectangleOperation operation = new RectangleOperation();

            operation.Target = input;
            int actual = operation.ComputeArea();
        }
        public void Given_Rectangle_Width_0_Height_0_When_ComputeArea_Then_0()
        {
            int       expected = 0;
            Rectangle input    = new Rectangle();

            input.Width  = 0;
            input.Height = 0;
            RectangleOperation operation = new RectangleOperation();

            operation.Target = input;
            int actual = operation.ComputeArea();

            Assert.AreEqual(expected, actual);
        }
        private void ComputeButton_Click(object sender, EventArgs e)
        {
            int width  = Convert.ToInt32(width_NumericUpDown.Value);
            int height = Convert.ToInt32(height_NumericUpDown.Value);

            RectangleLibrary.Rectangle rect = new RectangleLibrary.Rectangle()
            {
                Width = width, Height = height
            };
            RectangleOperation operation = new RectangleOperation();

            operation.Target = rect;
            int area = operation.ComputeArea();

            resultLabel.Text = $"長方形的面積為 {area}";
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int width = 0;

            Int32.TryParse(numericUpDown1.Value.ToString(), out width);
            var height = (int)numericUpDown2.Value;

            RectangleLibrary.Rectangle rect = new RectangleLibrary.Rectangle()
            {
                Width = width, Height = height
            };
            RectangleOperation operation = new RectangleOperation();

            operation.Target = rect;
            int area = operation.ComputeArea();

            label3.Text = area.ToString();
        }
        static void Main(string[] args)
        {
            int width  = 0;
            int height = 0;

            Console.WriteLine("請輸入長方形的寬");
            Int32.TryParse(Console.ReadLine(), out width);
            Console.WriteLine("請輸入長方形的高");
            Int32.TryParse(Console.ReadLine(), out height);
            Rectangle rect = new Rectangle()
            {
                Width = width, Height = height
            };
            RectangleOperation operation = new RectangleOperation();

            operation.Target = rect;
            int area = operation.ComputeArea();

            Console.WriteLine($"長方形的面積為{area}");

            Console.ReadLine();
        }