Exemple #1
0
        public void Room_CheckLeaveDirection_Guard()
        {
            Mock <IMobileObject>       mob        = new Mock <IMobileObject>();
            Mock <ITagWrapper>         tagWrapper = new Mock <ITagWrapper>();
            Mock <IGuard>              guard      = new Mock <IGuard>();
            Mock <INonPlayerCharacter> npc        = new Mock <INonPlayerCharacter>();

            tagWrapper.Setup(e => e.WrapInTag("You can not leave.", TagType.Info)).Returns("message");
            guard.Setup(e => e.GuardDirections).Returns(new HashSet <Direction>()
            {
                Direction.North
            });
            guard.Setup(e => e.BlockLeaveMessage).Returns("You can not leave.");
            npc.Setup(e => e.Personalities).Returns(new List <IPersonality>()
            {
                guard.Object
            });
            mob.Setup(e => e.Room).Returns(room);
            room.AddMobileObjectToRoom(npc.Object);

            GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object;

            IResult result = room.CheckLeaveDirection(mob.Object, Direction.North);

            Assert.IsFalse(result.ResultSuccess);
            Assert.AreEqual("message", result.ResultMessage);
        }
Exemple #2
0
        public void Room_CheckLeaveDirection_Guard()
        {
            lNpc.Add(npc.Object);

            IResult result = room.CheckLeaveDirection(mob.Object, Direction.North);

            Assert.IsTrue(result.AllowAnotherCommand);
            Assert.AreEqual("You can not leave.", result.ResultMessage);
        }