コード例 #1
0
        public void TestColonelColonel()
        {
            Piece att = new Colonel(Ownership.FirstPlayer);
            Piece def = new Colonel(Ownership.SecondPlayer);

            Assert.True(ConflictHandler.Handle(att, def) is EmptyCell);
        }
コード例 #2
0
        /// <summary>
        /// Фасад
        /// </summary>
        public static void GoFacadePrepareSq()
        {
            Sq      sq      = new Sq();
            Colonel colonel = new Colonel("Пикалов А.В", "Командир роты");

            Console.WriteLine("{0} {1} {2} Снаряжает свое подразделение:", colonel.post, colonel.rank, colonel.name);
            colonel.ToManage(sq);
            Console.ReadKey();
        }
コード例 #3
0
        public void TestFailOnSameSideAttackColonalFlag__ThrowsPieceConflictHandlerException()
        {
            Piece att = new Colonel(Ownership.SecondPlayer);
            ICell def = new Flag(Ownership.SecondPlayer);

            TestDelegate code = () => ConflictHandler.Handle(att, def);

            Assert.Throws(typeof(PieceConflictHandlerException), code);
        }
コード例 #4
0
        /// <summary>
        /// Information Expert
        /// </summary>
        public static void GoInformationExpertGetSolderCount()
        {
            Sq      sq      = new Sq();
            Colonel colonel = new Colonel("Пикалов А.В", "Командир роты");

            Console.WriteLine("{0} {1} {2} Снаряжает свое подразделение:", colonel.post, colonel.rank, colonel.name);
            Print(colonel.ToManage(sq));
            Console.WriteLine();
            colonel.GetSqSolderCount(sq);
            Console.ReadKey();
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: nadiacomanici/Mentorat_IM
        // https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/generics/constraints-on-type-parameters
        static void Main(string[] args)
        {
            var popescu  = new Colonel <Romanian>();
            var napoleon = new General <French>();

            var romanianRegiment = new Regiment <Infanterist, Romanian, Colonel <Romanian> >(popescu);

            romanianRegiment.RecruitSoldiers(10);
            romanianRegiment.Attack();

            var frenchRegiment = new Regiment <Tankist, French, General <French> >(napoleon);

            frenchRegiment.RecruitSoldiers(5);
            frenchRegiment.Attack();
        }
コード例 #6
0
        static void Main(string[] args)
        {
            Approver captain = new Captain();
            Approver major   = new Major();
            Approver colonel = new Colonel();

            captain
            .SetSuccessor(major)
            .SetSuccessor(colonel);

            captain.HandleRequest("Colonel! I need you <3");
            captain.HandleRequest("Major: How are you?");
            captain.HandleRequest("General: Is the general in there?");

            Console.ReadKey();
        }