コード例 #1
0
ファイル: Rabbit.cs プロジェクト: lolasimp/RabbitAndGeese
        public void SaddleThatGoose(Goose goose, Saddle saddle)
        {
            if (goose.Saddle != null)
            {
                goose.EmotionalState = "Exhausted";
                return;
            }

            if (goose.Size == saddle.Size)
            {
                goose.Saddle = saddle;
                saddle.InUse = true;
            }
            else if (goose.Size > saddle.Size)
            {
                goose.EmotionalState = "Distraught by your fat shaming";
            }
        }
コード例 #2
0
        } = new List <Saddle>();                                // adding a saddle to the rabbit and intialiing it

        public void SaddleThatGoose(Goose goose, Saddle saddle) // was created from unittesting when ctrl. was hit
        {
            // Refactoring

            if (goose.Saddle != null)
            {
                goose.EmotinalState = "Exhausted";
                return; // adding this code for the thrid scneario
            }
            if (goose.Size == saddle.Size)
            {
                goose.Saddle = saddle;
                saddle.InUse = true;
            }
            else if (goose.Size > saddle.Size)
            {
                goose.EmotinalState = "Distraught by fat shaming";
            }
        }