コード例 #1
0
        public void CreateBlackDragon()
        {
            var dragonFactory = new DragonFactory();

            var dragon = dragonFactory.Create(DragonFactory.DragonBreed.Black);

            Assert.AreEqual("Black Dragon", dragon.Name);
        }
コード例 #2
0
        public void CreateRedDragon()
        {
            var dragonFactory = new DragonFactory();

            var dragon = dragonFactory.Create(DragonFactory.DragonBreed.Red);

            Assert.AreEqual("Red Dragon", dragon.Name);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Console.SetIn(new StreamReader("ZeroTests.txt"));

            var dragonFactory = new DragonFactory();

            var numberOfDragons = int.Parse(
                Console.ReadLine());

            var dragons = new DragonCollection(new TypeNameEqualityComparer(),
                                               new DragonNameComparer(),
                                               new DragonCollectionConsoleVisualizer());

            for (var i = 0; i < numberOfDragons; i++)
            {
                var dragonInfo = Console.ReadLine();
                var dragon     = dragonFactory.Create(dragonInfo);
                dragons.Add(dragon);
            }

            dragons.Print();
        }