public void Setup() { tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag("Disarm [Trap]", TagType.Info)).Returns("message"); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; command = new Disarm(); performer = new Mock <IMobileObject>(); room = new Mock <IRoom>(); trap = new Mock <ITrap>(); random = new Mock <IRandom>(); performer.Setup(e => e.Room).Returns(room.Object); room.Setup(e => e.Traps).Returns(new List <ITrap>() { trap.Object }); trap.Setup(e => e.DisarmWord).Returns(new List <string>() { "arrow" }); random.Setup(e => e.Next(0)).Returns(5); GlobalReference.GlobalValues.Random = random.Object; }
public void Setup() { tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag("(C)ast [Spell Name] {Parameter(s)}", TagType.Info)).Returns("message"); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; command = new Cast(); }
public void Setup() { tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag("Equip [Item Name]", TagType.Info)).Returns("message"); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; command = new Equip(); }
public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); tagWrapper = new Mock <ITagWrapper>(); mockResult = new Mock <IResult>(); mobileObject = new Mock <IMobileObject>(); room = new Mock <IRoom>(); npc = new Mock <INonPlayerCharacter>(); merchant = new Mock <IMerchant>(); personality = new Mock <IPersonality>(); mockCommand = new Mock <ICommand>(); parmaeter = new Mock <IParameter>(); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x)); merchant.Setup(e => e.Buy(npc.Object, mobileObject.Object, 1)).Returns(mockResult.Object); merchant.Setup(e => e.List(npc.Object, mobileObject.Object)).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 }); mobileObject.Setup(e => e.Room).Returns(room.Object); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; command = new Buy(); }
public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); tagWrapper = new Mock <ITagWrapper>(); mob1 = new Mock <IMobileObject>(); mob2 = new Mock <IMobileObject>(); mockCommand = new Mock <ICommand>(); parm1 = new Mock <IParameter>(); findObjects = new Mock <IFindObjects>(); evaluateLevel = new Mock <IEvaluateLevelDifference>(); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x)); mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>() { parm1.Object }); parm1.Setup(e => e.ParameterValue).Returns("mob"); findObjects.Setup(e => e.FindObjectOnPersonOrInRoom(mob1.Object, "mob", 0, false, false, true, true, false)).Returns(mob2.Object); evaluateLevel.Setup(e => e.Evalute(mob1.Object, mob2.Object)).Returns("eval message"); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; GlobalReference.GlobalValues.FindObjects = findObjects.Object; GlobalReference.GlobalValues.EvaluateLevelDifference = evaluateLevel.Object; command = new Consider(); }
public void Setup() { tagWrapper = new Mock <ITagWrapper>(); mob = new Mock <IMobileObject>(); mockCommand = new Mock <ICommand>(); save = new Mock <IMobileObjectCommand>(); room = new Mock <IRoom>(); pcs = new List <IPlayerCharacter>(); notify = new Mock <INotify>(); tagWrapper.Setup(e => e.WrapInTag("Logout", TagType.Info)).Returns("message"); mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>()); mob.Setup(e => e.Room).Returns(room.Object); room.Setup(e => e.PlayerCharacters).Returns(pcs); Mock <ICommandList> commandList = new Mock <ICommandList>(); Dictionary <string, IMobileObjectCommand> commands = new Dictionary <string, IMobileObjectCommand>(); commands.Add("SAVE", save.Object); commandList.Setup(e => e.PcCommandsLookup).Returns(commands); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; GlobalReference.GlobalValues.CommandList = commandList.Object; GlobalReference.GlobalValues.Notify = notify.Object; command = new Logout(); }
public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x)); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; mob = new Mock <IMobileObject>(); mockCommand = new Mock <ICommand>(); command = new Spellbook(); spell1 = new Mock <ISpell>(); spell2 = new Mock <ISpell>(); Dictionary <string, ISpell> spells = new Dictionary <string, ISpell>(); mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>()); spell1.Setup(e => e.AbilityName).Returns("ABC"); spell1.Setup(e => e.ManaCost).Returns(1); spell2.Setup(e => e.AbilityName).Returns("AHHHHH"); spell2.Setup(e => e.ManaCost).Returns(2); spells.Add(spell1.Object.AbilityName, spell1.Object); spells.Add(spell2.Object.AbilityName, spell2.Object); mob.Setup(e => e.SpellBook).Returns(spells); }
public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x)); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; command = new Abilities(); mob = new Mock <IMobileObject>(); Mock <ISpell> spell = new Mock <ISpell>(); Mock <ISkill> skill = new Mock <ISkill>(); Mock <ISkill> skill2 = new Mock <ISkill>(); skill2.Setup(e => e.Passive).Returns(true); Dictionary <string, ISpell> spellBook = new Dictionary <string, ISpell>(); spellBook.Add("spell", spell.Object); mob.Setup(e => e.SpellBook).Returns(spellBook); Dictionary <string, ISkill> skills = new Dictionary <string, ISkill>(); skills.Add("skill", skill.Object); skills.Add("skill2", skill2.Object); mob.Setup(e => e.KnownSkills).Returns(skills); }
public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); tagWrapper = new Mock <ITagWrapper>(); mob = new Mock <IMobileObject>(); commandMock = new Mock <ICommand>(); find = new Mock <IFindObjects>(); room = new Mock <IRoom>(); npc = new Mock <INonPlayerCharacter>(); pc = new Mock <IPlayerCharacter>(); parmeter = new Mock <IParameter>(); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x)); mob.Setup(e => e.SentenceDescription).Returns("mob"); find.Setup(e => e.FindNpcInRoom(room.Object, "npc")).Returns(new List <INonPlayerCharacter>() { npc.Object }); find.Setup(e => e.FindNpcInRoom(room.Object, "pc")).Returns(new List <INonPlayerCharacter>()); find.Setup(e => e.FindNpcInRoom(room.Object, "other")).Returns(new List <INonPlayerCharacter>()); find.Setup(e => e.FindPcInRoom(room.Object, "pc")).Returns(new List <IPlayerCharacter>() { pc.Object }); find.Setup(e => e.FindPcInRoom(room.Object, "npc")).Returns(new List <IPlayerCharacter>()); find.Setup(e => e.FindPcInRoom(room.Object, "other")).Returns(new List <IPlayerCharacter>()); mob.Setup(e => e.Room).Returns(room.Object); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; GlobalReference.GlobalValues.FindObjects = find.Object; command = new Possess(); }
public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); tagWrapper = new Mock <ITagWrapper>(); mob = new Mock <IMobileObject>(); mockCommand = new Mock <ICommand>(); fileIO = new Mock <IFileIO>(); settings = new Mock <ISettings>(); time = new Mock <ITime>(); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x)); mob.Setup(e => e.KeyWords).Returns(new List <string>() { "mob" }); settings.Setup(e => e.BugDirectory).Returns("bugDirectory"); time.Setup(e => e.CurrentDateTime).Returns(new DateTime(2000, 1, 1)); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; GlobalReference.GlobalValues.FileIO = fileIO.Object; GlobalReference.GlobalValues.Settings = settings.Object; GlobalReference.GlobalValues.Time = time.Object; command = new Bug(); }
private void ProcessMobCommunication(IMobileObject mob) { IResult result = null; while (result == null || result.AllowAnotherCommand == true) { string communication = mob.DequeueCommunication(); if (communication != null) { ICommand command = GlobalReference.GlobalValues.Parser.Parse(communication); if (command != null) { IMobileObjectCommand mobCommand = GlobalReference.GlobalValues.CommandList.GetCommand(mob, command.CommandName); if (mobCommand == null) { result = new Result("Unknown command.", true); } else { result = mobCommand.PerformCommand(mob, command); } GlobalReference.GlobalValues.Notify.Mob(mob, new TranslationMessage(result.ResultMessage)); } } else { break; } } }
public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); tagWrapper = new Mock <ITagWrapper>(); mob = new Mock <IMobileObject>(); cando = new Mock <ICanMobDoSomething>(); item = new Mock <IItem>(); find = new Mock <IFindObjects>(); npc = new Mock <INonPlayerCharacter>(); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x)); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Item)).Returns((string x, TagType y) => (x)); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.NonPlayerCharacter)).Returns((string x, TagType y) => (x)); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Room)).Returns((string x, TagType y) => (x)); mob.Setup(e => e.Position).Returns(CharacterPosition.Stand); cando.Setup(e => e.SeeDueToLight(mob.Object)).Returns(true); item.Setup(e => e.ExamineDescription).Returns("desc"); find.Setup(e => e.FindObjectOnPersonOrInRoom(mob.Object, "item", 0, true, true, true, true, true)).Returns(item.Object); find.Setup(e => e.FindObjectOnPersonOrInRoom(mob.Object, "item", 1, true, true, true, true, true)).Returns <IBaseObject>(null); find.Setup(e => e.FindObjectOnPersonOrInRoom(mob.Object, "npc", 0, true, true, true, true, true)).Returns(npc.Object); find.Setup(e => e.DetermineFoundObjectTagType(item.Object)).Returns(TagType.Item); find.Setup(e => e.DetermineFoundObjectTagType(npc.Object)).Returns(TagType.NonPlayerCharacter); npc.Setup(e => e.ExamineDescription).Returns("Examine Description"); npc.Setup(e => e.HealthDescription).Returns("Health Description"); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; GlobalReference.GlobalValues.CanMobDoSomething = cando.Object; GlobalReference.GlobalValues.FindObjects = find.Object; command = new Examine(); }
public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); tagWrapper = new Mock <ITagWrapper>(); pc = new Mock <IPlayerCharacter>(); god = new Mock <IPlayerCharacter>(); world = new Mock <IWorld>(); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x)); pc.Setup(e => e.God).Returns(false); pc.Setup(e => e.Name).Returns("player character"); pc.Setup(e => e.Level).Returns(10); pc.Setup(e => e.Title).Returns("title"); god.Setup(e => e.God).Returns(true); god.Setup(e => e.Name).Returns("god"); god.Setup(e => e.Level).Returns(1); god.Setup(e => e.Title).Returns <string>(null); world.Setup(e => e.CurrentPlayers).Returns(new List <IPlayerCharacter>() { pc.Object, god.Object }); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; GlobalReference.GlobalValues.World = world.Object; command = new Who(); }
private static Dictionary <string, IMobileObjectCommand> CreateCommandLookupList(string commandType) { SortedDictionary <string, IMobileObjectCommand> sortedDictionary = CreateCommandList(commandType); //We could have just done a search on the sorted dictionary for the 1st command that matched //the whole string passed in but I decided it would be better to go ahead and make a dictionary //entry for every possibility. Startup is a bit slower this way runtime look up is as fast as possible. Dictionary <string, IMobileObjectCommand> allKeysDictionary = new Dictionary <string, IMobileObjectCommand>(); foreach (string key in sortedDictionary.Keys) { IMobileObjectCommand mobCommand = sortedDictionary[key]; for (int i = 1; i <= key.Length; i++) { string subKey = key.Substring(0, i).ToUpper(); if (!allKeysDictionary.ContainsKey(subKey)) { allKeysDictionary.Add(subKey, mobCommand); } } } return(allKeysDictionary); }
public void Setup() { tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag("Follow {Target}", TagType.Info)).Returns("message"); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; command = new Follow(); }
public void Setup() { tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag("(Inv)entory", TagType.Info)).Returns("message"); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; command = new Inventory(); }
public void Setup() { tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag("RetrieveGameStats", TagType.Info)).Returns("message"); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; command = new RetrieveGameStats(); }
public void CommandList_GetCommand_FindPcCommand() { Mock <IPlayerCharacter> pc = new Mock <IPlayerCharacter>(); IMobileObjectCommand command = commandList.GetCommand(pc.Object, "LOOK"); Assert.AreEqual(typeof(Look), command.GetType()); }
public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x)); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; command = new Equip(); }
public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x)); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; mob = new Mock <IMobileObject>(); npc1 = new Mock <INonPlayerCharacter>(); npc2 = new Mock <INonPlayerCharacter>(); room = new Mock <IRoom>(); mockCommand = new Mock <ICommand>(); combatEngine = new Mock <ICombat>(); findObjects = new Mock <IFindObjects>(); Mock <IResult> result1 = new Mock <IResult>(); result1.Setup(e => e.AllowAnotherCommand).Returns(false); result1.Setup(e => e.ResultMessage).Returns("1"); Mock <IResult> result2 = new Mock <IResult>(); result2.Setup(e => e.AllowAnotherCommand).Returns(false); result2.Setup(e => e.ResultMessage).Returns("2"); npc1.Setup(e => e.KeyWords).Returns(new List <string>() { "npc1" }); npc1.Setup(e => e.SentenceDescription).Returns("npc1 sentence"); npc2.Setup(e => e.KeyWords).Returns(new List <string>() { "npc2" }); npc2.Setup(e => e.SentenceDescription).Returns("npc2 sentence"); room.Setup(e => e.NonPlayerCharacters).Returns(new List <INonPlayerCharacter>() { npc1.Object, npc2.Object }); room.Setup(e => e.Attributes).Returns(new HashSet <RoomAttribute>()); mob.Setup(e => e.Room).Returns(room.Object); mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>()); Mock <IEngine> engine = new Mock <IEngine>(); engine.Setup(e => e.Combat).Returns(combatEngine.Object); GlobalReference.GlobalValues.Engine = engine.Object; findObjects.Setup(e => e.FindObjectOnPersonOrInRoom(mob.Object, "npc1", 0, false, false, true, true, true)).Returns(npc1.Object); GlobalReference.GlobalValues.FindObjects = findObjects.Object; command = new Kill(); }
public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x)); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Item)).Returns((string x, TagType y) => (x)); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.NonPlayerCharacter)).Returns((string x, TagType y) => (x)); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.PlayerCharacter)).Returns((string x, TagType y) => (x)); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Mob)).Returns((string x, TagType y) => (x)); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; mob = new Mock <IPlayerCharacter>(); mockCommand = new Mock <ICommand>(); room = new Mock <IRoom>(); canDoSomething = new Mock <ICanMobDoSomething>(); item = new Mock <IEquipment>(); npc = new Mock <INonPlayerCharacter>(); pc = new Mock <IPlayerCharacter>(); otherMob = new Mock <IMobileObject>(); mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>()); mob.Setup(e => e.Room).Returns(room.Object); mob.Setup(e => e.Debug).Returns(true); item.Setup(e => e.ShortDescription).Returns("ItemShortDescription"); npc.Setup(e => e.ShortDescription).Returns("NpcShortDescription"); pc.Setup(e => e.ShortDescription).Returns("PcShortDescription"); otherMob.Setup(e => e.ShortDescription).Returns("OtherMobShortDescription"); room.Setup(e => e.Items).Returns(new List <IItem>() { item.Object }); room.Setup(e => e.NonPlayerCharacters).Returns(new List <INonPlayerCharacter>() { npc.Object }); room.Setup(e => e.PlayerCharacters).Returns(new List <IPlayerCharacter>() { mob.Object, pc.Object }); room.Setup(e => e.OtherMobs).Returns(new List <IMobileObject>() { otherMob.Object }); room.Setup(e => e.ShortDescription).Returns("RoomShortDescription"); room.Setup(e => e.LookDescription).Returns("RoomLookDescription"); canDoSomething.Setup(e => e.SeeDueToLight(mob.Object)).Returns(true); canDoSomething.Setup(e => e.SeeObject(mob.Object, item.Object)).Returns(true); canDoSomething.Setup(e => e.SeeObject(mob.Object, npc.Object)).Returns(true); canDoSomething.Setup(e => e.SeeObject(mob.Object, pc.Object)).Returns(true); canDoSomething.Setup(e => e.SeeObject(mob.Object, otherMob.Object)).Returns(true); GlobalReference.GlobalValues.CanMobDoSomething = canDoSomething.Object; command = new Look(); }
public void CommandList_GetCommand_GodCanRunGodCommand() { Mock <IPlayerCharacter> pc = new Mock <IPlayerCharacter>(); pc.Setup(e => e.God).Returns(true); IMobileObjectCommand command = commandList.GetCommand(pc.Object, "ITEMSTATS"); Assert.AreEqual(typeof(ItemStats), command.GetType()); }
public void CommandList_GetCommand_NotGodCannotRunGodCommand() { Mock <IPlayerCharacter> pc = new Mock <IPlayerCharacter>(); pc.Setup(e => e.God).Returns(false); IMobileObjectCommand command = commandList.GetCommand(pc.Object, "ITEMSTATS"); Assert.IsNull(command); }
public void CommandList_GetCommand_LReturnsLook() { Mock <IPlayerCharacter> pc = new Mock <IPlayerCharacter>(); pc.Setup(e => e.God).Returns(false); IMobileObjectCommand command = commandList.GetCommand(pc.Object, "L"); Assert.AreEqual(typeof(Look), command.GetType()); }
public void Setup() { tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag("(Stats) Statistics", TagType.Info)).Returns("message"); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; mob = new Mock <IMobileObject>(); mockCommand = new Mock <ICommand>(); command = new Statistics(); mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>()); }
public void Setup() { tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag("(P)erform [Skill Name] {Parameter(s)}", TagType.Info)).Returns("message"); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; mob = new Mock <IMobileObject>(); mockCommand = new Mock <ICommand>(); command = new Perform(); mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>()); }
public void Setup() { tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag("Do you really need to Man the Manual?", TagType.Info)).Returns("message"); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; mob = new Mock <IPlayerCharacter>(); mockCommand = new Mock <ICommand>(); mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>()); command = new Manual(); }
public void Setup() { tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag("Recall {Set}", TagType.Info)).Returns("message"); tagWrapper.Setup(e => e.WrapInTag("Your body begins to shimmer and become translucent.\r\nThe surroundings begin to fade to black and then new scenery appears before you.\r\nSlowly your body becomes solid again and you can see the recall crystal in front of you.", TagType.Info)).Returns("message"); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; mob = new Mock <IMobileObject>(); mockCommand = new Mock <ICommand>(); command = new Recall(); mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>()); }
public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x)); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; mob = new Mock <IMobileObject>(); mockCommand = new Mock <ICommand>(); findObjects = new Mock <IFindObjects>(); parameter = new Mock <IParameter>(); door = new Mock <IDoor>(); item = new Mock <IItem>(); openableItem = item.As <IOpenable>(); openableDoor = door.As <IOpenable>(); key = new Mock <IItem>(); mockResult = new Mock <IResult>(); door2 = new Mock <IDoor>(); room2 = new Mock <IRoom>(); exit2 = new Mock <IExit>(); world = new Mock <IWorld>(); zone = new Mock <IZone>(); zones = new Dictionary <int, IZone>(); rooms = new Dictionary <int, IRoom>(); linkedRoomId = new Mock <IBaseObjectId>(); command = new Open(); mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>() { parameter.Object }); findObjects.Setup(e => e.FindObjectOnPersonOrInRoom(mob.Object, "item", 0, true, true, false, false, true)).Returns(item.Object); findObjects.Setup(e => e.FindObjectOnPersonOrInRoom(mob.Object, "door", 0, true, true, false, false, true)).Returns(door.Object); mob.Setup(e => e.Items).Returns(new List <IItem>() { key.Object }); door.Setup(e => e.Locked).Returns(true); door.Setup(e => e.Linked).Returns(true); door.Setup(e => e.LinkedRoomId).Returns(linkedRoomId.Object); openableDoor.Setup(e => e.Open(mob.Object)).Returns(mockResult.Object); exit2.Setup(e => e.Door).Returns(door2.Object); linkedRoomId.Setup(e => e.Id).Returns(2); linkedRoomId.Setup(e => e.Zone).Returns(1); world.Setup(e => e.Zones).Returns(zones); zone.Setup(e => e.Rooms).Returns(rooms); GlobalReference.GlobalValues.FindObjects = findObjects.Object; GlobalReference.GlobalValues.World = world.Object; }
public void Setup() { GlobalReference.GlobalValues = new GlobalValues(); tagWrapper = new Mock <ITagWrapper>(); tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x)); GlobalReference.GlobalValues.TagWrapper = tagWrapper.Object; mob = new Mock <IMobileObject>(); mockCommand = new Mock <ICommand>(); command = new Sit(); mockCommand.Setup(e => e.Parameters).Returns(new List <IParameter>()); }