コード例 #1
0
ファイル: GameFactory.cs プロジェクト: MantasVa/Kata.FizzBuzz
        public IGame CreateGameRules(string rules = null)
        {
            IGame game;

            switch (rules)
            {
            case "Whizz":
            {
                IStrategy whizzStrategy = new WhizzStrategy();
                game = new Game(whizzStrategy.GetExtraRule);
                break;
            }

            case "FizzBuzz":
            {
                IStrategy fizzStrategy = new FizzBuzzStrategy();
                game = new Game(fizzStrategy.GetExtraRule);
                break;
            }

            default:
                game = new Game();
                break;
            }
            return(game);
        }
コード例 #2
0
        public void PrintRelationships_ValidNumber_WritesToConsole()
        {
            // arrange
            var strategy = new FizzBuzzStrategy();

            try
            {
                // act
                strategy.PrintRelationships(0);
            }
            catch (Exception ex)
            {
                // assert .. all we can do is explicitly fail if this code gets hit.
                Assert.Fail("Expected no exception and got this", ex);
            }
        }