示例#1
0
        public void Join_PerformCommand_NoParm()
        {
            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsFalse(result.AllowAnotherCommand);
            Assert.AreEqual("1", result.ResultMessage);
        }
示例#2
0
        public void Receive_NotPc()
        {
            IResult result = command.PerformCommand(npc.Object, null);

            Assert.IsTrue(result.AllowAnotherCommand);
            Assert.AreEqual("Only player characters can receive.", result.ResultMessage);
        }
示例#3
0
        public void WaitUnitTest_Pc()
        {
            IResult result = command.PerformCommand(pc.Object, mockCommand.Object);

            Assert.AreEqual(null, result.ResultMessage);
            Assert.IsTrue(result.AllowAnotherCommand);
        }
示例#4
0
        public void Abilities_PerformCommand_Abilities()
        {
            IResult result = command.PerformCommand(mob.Object, null);

            Assert.IsFalse(result.AllowAnotherCommand);
            Assert.AreEqual("Spells\r\nspell\r\n\r\nSkills\r\nskill  - Active\r\nskill2 - Passive", result.ResultMessage);
        }
示例#5
0
        public void Perform_PerformCommand_NoParameter()
        {
            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsTrue(result.AllowAnotherCommand);
            Assert.AreEqual("What skill would you like to use?", result.ResultMessage);
        }
示例#6
0
文件: JoinUnitTest.cs 项目: crybx/mud
        public void Join_PerformCommand_NoParm()
        {
            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsTrue(result.ResultSuccess);
            Assert.AreEqual("1", result.ResultMessage);
        }
示例#7
0
        public void Buy_PerformCommand_Buy()
        {
            Mock <IResult> mockResult = new Mock <IResult>();

            Mock <IMobileObject>       mob      = new Mock <IMobileObject>();
            Mock <IRoom>               room     = new Mock <IRoom>();
            Mock <INonPlayerCharacter> npc      = new Mock <INonPlayerCharacter>();
            Mock <IMerchant>           merchant = new Mock <IMerchant>();

            merchant.Setup(e => e.Buy(npc.Object, mob.Object, 1)).Returns(mockResult.Object);
            npc.Setup(e => e.Personalities).Returns(new List <IPersonality>()
            {
                merchant.Object
            });
            room.Setup(e => e.NonPlayerCharacters).Returns(new List <INonPlayerCharacter>()
            {
                npc.Object
            });
            mob.Setup(e => e.Room).Returns(room.Object);

            Mock <ICommand>   mockedCommand = new Mock <ICommand>();
            Mock <IParameter> parmaeter     = new Mock <IParameter>();

            parmaeter.Setup(e => e.ParameterValue).Returns("1");
            mockedCommand.Setup(e => e.Parameters).Returns(new List <IParameter>()
            {
                parmaeter.Object
            });

            Assert.AreSame(mockResult.Object, command.PerformCommand(mob.Object, mockedCommand.Object));
        }
示例#8
0
        public void Save_PerformCommand_NotPc()
        {
            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsTrue(result.AllowAnotherCommand);
            Assert.AreEqual("Only PlayerCharacters can save.", result.ResultMessage);
        }
示例#9
0
        public void Kill_PerformCommand_NoParmeterWithNpc()
        {
            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsFalse(result.AllowAnotherCommand);
            Assert.AreEqual("You begin to attack npc1 sentence.", result.ResultMessage);
            combatEngine.Verify(e => e.AddCombatPair(mob.Object, npc1.Object), Times.Once);
        }
示例#10
0
文件: SaveUnitTest.cs 项目: crybx/mud
        public void Save_PerformCommand_NotPc()
        {
            tagWrapper.Setup(e => e.WrapInTag("Only PlayerCharacters can save.", TagType.Info)).Returns("message");

            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsFalse(result.ResultSuccess);
            Assert.AreEqual("message", result.ResultMessage);
        }
示例#11
0
        public void Receive_NotPc()
        {
            tagWrapper.Setup(e => e.WrapInTag("Only player characters can receive.", TagType.Info)).Returns("message");

            IResult result = command.PerformCommand(npc.Object, null);

            Assert.IsFalse(result.ResultSuccess);
            Assert.AreEqual("message", result.ResultMessage);
        }
示例#12
0
        public void ItemStats_PerformCommand_NoParameter()
        {
            commandMock.Setup(e => e.Parameters).Returns(new List <IParameter>());

            IResult result = command.PerformCommand(mob.Object, commandMock.Object);

            Assert.IsTrue(result.AllowAnotherCommand);
            Assert.AreEqual("What item would you like to get stats on?", result.ResultMessage);
        }
示例#13
0
        public void Possess_PerformCommand_NoParameterNoPossession()
        {
            commandMock.Setup(e => e.Parameters).Returns(new List <IParameter>());

            IResult result = command.PerformCommand(mob.Object, commandMock.Object);

            Assert.IsTrue(result.AllowAnotherCommand);
            Assert.AreEqual("You were not possessing anyone.", result.ResultMessage);
        }
示例#14
0
        public void Bug_PeformCommand_NoParameters()
        {
            mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>());

            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsTrue(result.AllowAnotherCommand);
            Assert.AreEqual("Please describe the bug.", result.ResultMessage);
        }
示例#15
0
文件: TellUnitTest.cs 项目: crybx/mud
        public void Tell_PerformCommand_NoParameter()
        {
            tagWrapper.Setup(e => e.WrapInTag("Who would you like to tell what?", TagType.Info)).Returns("message");

            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsFalse(result.ResultSuccess);
            Assert.AreEqual("message", result.ResultMessage);
        }
示例#16
0
        public void Turn_PerformCommand_NoParameter()
        {
            mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>());

            IResult result = command.PerformCommand(mobileObject.Object, mockCommand.Object);

            Assert.IsTrue(result.AllowAnotherCommand);
            Assert.AreEqual("Turn {Item Keyword}", result.ResultMessage);
        }
示例#17
0
        public void Consider_NoParams()
        {
            mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>());

            IResult result = command.PerformCommand(mob1.Object, mockCommand.Object);

            Assert.IsTrue(result.AllowAnotherCommand);
            Assert.AreEqual("Who would you like to consider attacking?", result.ResultMessage);
        }
示例#18
0
        public void Learn_PerformCommand_NoParameter()
        {
            mob.Setup(e => e.LevelPoints).Returns(5);

            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsFalse(result.AllowAnotherCommand);
            Assert.AreEqual("You have 5 points to spend.", result.ResultMessage);
        }
示例#19
0
        public void Learn_PerformCommand_NoParameter()
        {
            mob.Setup(e => e.LevelPoints).Returns(5);
            tagWrapper.Setup(e => e.WrapInTag("You have 5 points to spend.", TagType.Info)).Returns("message");

            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsTrue(result.ResultSuccess);
            Assert.AreEqual("message", result.ResultMessage);
        }
示例#20
0
        public void Buy_PerformCommand_Buy()
        {
            parmaeter.Setup(e => e.ParameterValue).Returns("1");
            mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>()
            {
                parmaeter.Object
            });

            Assert.AreSame(mockResult.Object, command.PerformCommand(mobileObject.Object, mockCommand.Object));
        }
示例#21
0
        public void Emote_PerformCommand_NoParameter()
        {
            Mock <ICommand> mockCommand = new Mock <ICommand>();

            mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>());

            IResult result = command.PerformCommand(performer.Object, mockCommand.Object);

            Assert.IsTrue(result.AllowAnotherCommand);
            Assert.AreEqual("What would you like to emote?", result.ResultMessage);
        }
示例#22
0
        public void Abilities_PerformCommand_Abilities()
        {
            Mock <ITagWrapper> tagWrapper = new Mock <ITagWrapper>();

            tagWrapper.Setup(e => e.WrapInTag("Spells\r\nspell\r\n\r\nSkills\r\nskill  - Active\r\nskill2 - Passive", TagType.Info)).Returns("message");
            GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object;

            IResult result = command.PerformCommand(mob.Object, null);

            Assert.IsTrue(result.ResultSuccess);
            Assert.AreEqual("message", result.ResultMessage);
        }
示例#23
0
        public void Goto_PerformCommand_NoParameters()
        {
            Mock <ICommand> mockCommand = new Mock <ICommand>();

            mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>());
            tagWrapper.Setup(e => e.WrapInTag("Where would you like to goto?", TagType.Info)).Returns("message");

            IResult result = command.PerformCommand(pc.Object, mockCommand.Object);

            Assert.IsFalse(result.ResultSuccess);
            Assert.AreEqual("message", result.ResultMessage);
        }
示例#24
0
        public void Cast_PerformCommand_NoParameter()
        {
            Mock <IMobileObject> mob         = new Mock <IMobileObject>();
            Mock <ICommand>      mockCommand = new Mock <ICommand>();

            mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>());

            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsTrue(result.AllowAnotherCommand);
            Assert.AreEqual("What spell would you like to cast?", result.ResultMessage);
        }
示例#25
0
        public void Look_PerformCommand_Dark()
        {
            canDoSomething.Setup(e => e.SeeDueToLight(mob.Object)).Returns(false);

            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsTrue(result.AllowAnotherCommand);
            Assert.AreEqual("You can not see here because it is to dark.", result.ResultMessage);
        }
示例#26
0
        public void Follow_PerformCommand_NoParamsNotFollowing()
        {
            Mock <ICommand> mockCommand = new Mock <ICommand>();

            mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>());

            Mock <IMobileObject> mob = new Mock <IMobileObject>();

            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.AreEqual(true, result.AllowAnotherCommand);
            Assert.AreEqual("You are not following anyone.", result.ResultMessage);
        }
示例#27
0
        public void Party_PerformCommand_NoParmaeters()
        {
            mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>());

            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsTrue(result.AllowAnotherCommand);
            Assert.AreEqual(@"Party Invite {Person To Invite}
Party Decline
Party {Message To Send To Party}
Party Start
Party Leave", result.ResultMessage);
        }
示例#28
0
文件: LookUnitTest.cs 项目: crybx/mud
        public void Look_PerformCommand_Sleep()
        {
            mob.Setup(e => e.Position).Returns(CharacterPosition.Sleep);
            tagWrapper.Setup(e => e.WrapInTag("You can not look while asleep.", TagType.Info)).Returns("message");

            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsFalse(result.ResultSuccess);
            Assert.AreEqual("message", result.ResultMessage);
        }
示例#29
0
        public void Search_PerformCommand_NothingFound()
        {
            Mock <IParameter> parameter = new Mock <IParameter>();

            mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>()
            {
                parameter.Object
            });

            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsFalse(result.AllowAnotherCommand);
            Assert.AreEqual("Nothing found was found.", result.ResultMessage);
        }
示例#30
0
        public void Search_PerformCommand_NothingFound()
        {
            Mock <IParameter> parameter = new Mock <IParameter>();

            tagWrapper.Setup(e => e.WrapInTag("Nothing found was found.", TagType.Info)).Returns("message");
            mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>()
            {
                parameter.Object
            });

            IResult result = command.PerformCommand(mob.Object, mockCommand.Object);

            Assert.IsTrue(result.ResultSuccess);
            Assert.AreEqual("message", result.ResultMessage);
        }