コード例 #1
0
        public void TakeStartingPosition()
        {
            //Arrange
            PictureBox myPictureBox = new PictureBox();
            Random     randomizer   = new Random();
            Squirrel   squirrel     = new Squirrel()
            {
                StartingPosition = 90,
                RacetrackLength  = 100,
                MyPictureBox     = myPictureBox,
                Randomizer       = randomizer
            };

            myPictureBox.Location = new Point(50, 0); //Set the location to an arbitrary coordinate
            Point expectedLocation = new Point(90, 0);

            //Act
            squirrel.TakeStartingPosition();
            Point actualLocation = squirrel.MyPictureBox.Location;

            //Assert
            Assert.AreEqual(expectedLocation.X, actualLocation.X);
        }