public void TestColonelColonel() { Piece att = new Colonel(Ownership.FirstPlayer); Piece def = new Colonel(Ownership.SecondPlayer); Assert.True(ConflictHandler.Handle(att, def) is EmptyCell); }
/// <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(); }
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); }
/// <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(); }
// 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(); }
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(); }