Example #1
0
        public void TestDriveGroupTable()
        {
            Table table = new Table(10, 64, 64);

            table.State = EquipmentState.InUse;
            RankChief rankChief = new RankChief(32, 32);

            rankChief.Squares[0].Tables.Add(table);

            TableController tableController = new TableController();

            tableController.DriveGroupTable(table, rankChief);
            Assert.IsNull(table.Group);
            Assert.AreEqual(32, rankChief.PosX);
            Assert.AreEqual(32, rankChief.PosY);

            Group group = new Group(128, 128);

            Assert.IsNotNull(group);
            table.Group = group;
            Assert.IsNotNull(table.Group);
            tableController.DriveGroupTable(table, rankChief);
            Assert.AreEqual(table.PosX - 32, rankChief.PosX);
            Assert.AreEqual(table.PosY, rankChief.PosY);
            Assert.AreEqual(table.PosX, group.PosX);
            Assert.AreEqual(table.PosY, group.PosY);
        }
Example #2
0
 public void CallRankChief(RankChief rankChief)
 {
     if (rankChief != null)
     {
         rankChief.Move(hotelMaster.PosX - 10, hotelMaster.PosY);
     }
 }
Example #3
0
 public void DriveGroupTable(Table table, RankChief rankChief)
 {
     if (table.Group != null)
     {
         table.Group.Move(table.PosX, table.PosY);
         rankChief.Move(table.PosX - 32, table.PosY);
     }
 }
Example #4
0
        public RankChief FindRankChief(Group group)
        {
            RankChief designatedRankchief = this.hotelMaster.RankChiefs.Find(
                rankchief => rankchief.Squares[0].Tables.Exists(
                    table => table.Group == group));

            return(designatedRankchief);
        }
Example #5
0
        public void TestCallRankChief()
        {
            Group group = welcomeController.CreateGroup(5);

            hotelMaster.RankChiefs[0].Squares[0].Tables[4].Group = group;
            RankChief designatedRankChief = welcomeController.FindRankChief(group);

            Assert.AreEqual(hotelMaster.RankChiefs[0], designatedRankChief);
            welcomeController.CallRankChief(designatedRankChief);
            Assert.AreEqual(hotelMaster.PosX - 10, designatedRankChief.PosX);
            Console.WriteLine(hotelMaster.PosY);
            Console.WriteLine(designatedRankChief.PosY);
            Assert.AreEqual(hotelMaster.PosY, designatedRankChief.PosY);
        }
        public void TestRankChiefConstruct()
        {
            RankChief BasicRankChief = new RankChief();

            Assert.AreEqual(0, BasicRankChief.PosX);
            Assert.AreEqual(0, BasicRankChief.PosY);
            RankChief PositionedRankChief = new RankChief(1, 11);

            Assert.AreEqual(1, PositionedRankChief.PosX);
            Assert.AreEqual(11, PositionedRankChief.PosY);
            RankChief WrongPositioningRankChief = new RankChief(-6, -8);

            Assert.AreEqual(0, WrongPositioningRankChief.PosX);
            Assert.AreEqual(0, WrongPositioningRankChief.PosY);
            Assert.IsNotNull(BasicRankChief.Squares);
            Assert.IsNotNull(PositionedRankChief.Squares);
        }