コード例 #1
0
        private void LoadPlanes()
        {
            // Array of front-end PictureBoxes
            PictureBox[] pbxPlanes = { pbxPlane1, pbxPlane2, pbxPlane3, pbxPlane4 };

            // Instantiate a PaperPlane for each item (Plane) in pbxPlanes
            for (int i = 0; i < pbxPlanes.Length; i++)
            {
                // +1 when assigning ID so we start at 1 not 0.
                myPaperPlanes[i] = new PaperPlane {
                    myPictureBox = pbxPlanes[i], planeID = (i + 1), planeStartingPositionX = pbxPlanes[i].Left
                };
                myPaperPlanes[i].myPictureBox.BackgroundImage = Resources.paperplane;
            }
        }
コード例 #2
0
        public void Print_Im_a_paper_plane_On_Display()
        {
            var p = new PaperPlane();

            Assert.AreEqual(p.Display(), "I'm a paper plane!");
        }
コード例 #3
0
        public void Print_Crash_On_Land()
        {
            var p = new PaperPlane();

            Assert.AreEqual(p.Land(), "Crash!");
        }
コード例 #4
0
        public void Print_No_engine_to_start_On_StartEngine()
        {
            var p = new PaperPlane();

            Assert.AreEqual(p.SingleEnginePlane(), "No engine to start!");
        }
コード例 #5
0
        public void Print_Flying_with_paper_wings_On_Fly()
        {
            var p = new PaperPlane();

            Assert.AreEqual(p.Fly(), "Flying with paper wings");
        }