public void Problem1_FindTheBug()
        {
            var target = new Problem1();

            int x           = 5;
            int y           = 10;
            var pointStruct = new MutablePointStruct()
            {
                X = x, Y = y
            };
            var result = target.FindTheBug(pointStruct);

            Assert.AreEqual(x * 2, result.X);
            Assert.AreEqual(y * 2, result.Y);
            Assert.AreNotSame(pointStruct, result);
        }
        public void Problem1_PointStruct_SideAffecting()
        {
            // Instantiate the problem
            var target = new Problem1();

            // Set up the test
            int x           = 5;
            int y           = 10;
            var pointStruct = new MutablePointStruct()
            {
                X = x, Y = y
            };
            var result = target.DoubleTheTargetPointStruct(pointStruct);

            // Assert truths.
            Assert.AreEqual(x * 2, result.X);
            Assert.AreEqual(y * 2, result.Y);
        }
 /// <summary>
 /// Find the bug below and fix it.
 /// </summary>
 /// <param name="pointStruct">
 /// A target point struct.
 /// </param>
 /// <returns>
 /// A modified point struct whose X and Y values are twice the original.
 /// </returns>
 public MutablePointStruct FindTheBug(MutablePointStruct pointStruct)
 {
     return new MutablePointStruct(pointStruct.X * 2, pointStruct.Y * 2);
 }
 /// <summary>
 /// Modify the passed in point struct and return it such that the X and Y values are twice
 /// their original values. Because we're using structs, we have to let the parameter escape 
 /// the method or our changes will never stick.
 /// </summary>
 /// <param name="pointStruct">
 /// The point struct to modify.
 /// </param>
 /// <returns>
 /// The modified point struct whose X and Y values are double those of the input.
 /// </returns>
 public MutablePointStruct DoubleTheTargetPointStruct(MutablePointStruct pointStruct)
 {
     var myNewStruct = new MutablePointStruct(pointStruct.X * 2, pointStruct.Y * 2);
     return myNewStruct;
 }
 /// <summary>
 /// Find the bug below and fix it.
 /// </summary>
 /// <param name="pointStruct">
 /// A target point struct.
 /// </param>
 /// <returns>
 /// A modified point struct whose X and Y values are twice the original.
 /// </returns>
 public MutablePointStruct FindTheBug(MutablePointStruct pointStruct)
 {
     return(new MutablePointStruct(pointStruct.X * 2, pointStruct.Y * 2));
 }
        /// <summary>
        /// Modify the passed in point struct and return it such that the X and Y values are twice
        /// their original values. Because we're using structs, we have to let the parameter escape
        /// the method or our changes will never stick.
        /// </summary>
        /// <param name="pointStruct">
        /// The point struct to modify.
        /// </param>
        /// <returns>
        /// The modified point struct whose X and Y values are double those of the input.
        /// </returns>
        public MutablePointStruct DoubleTheTargetPointStruct(MutablePointStruct pointStruct)
        {
            var myNewStruct = new MutablePointStruct(pointStruct.X * 2, pointStruct.Y * 2);

            return(myNewStruct);
        }