Ejemplo n.º 1
0
        public void Room_AddMobToRoom_Npc()
        {
            room.AddMobileObjectToRoom(npc.Object);

            Assert.AreEqual(1, lNpc.Count());
            Assert.AreEqual(0, lPc.Count());
            Assert.AreEqual(0, lOtherMob.Count());
            Assert.IsTrue(room.NonPlayerCharacters.Contains(npc.Object));
        }
Ejemplo n.º 2
0
        public void Room_CheckEnter_NpcNotSmall()
        {
            Mock <INonPlayerCharacter> mob = new Mock <INonPlayerCharacter>();

            room.AddMobileObjectToRoom(new Mock <INonPlayerCharacter>().Object);

            Assert.IsNull(room.CheckEnter(mob.Object));
        }
Ejemplo n.º 3
0
        public void Zone_SeralizeDeserialize()
        {
            IZone zone = new Objects.Zone.Zone();
            IRoom room = new Objects.Room.Room();
            IItem item = new Objects.Item.Item();
            INonPlayerCharacter npc = new Objects.Mob.NonPlayerCharacter();
            IPlayerCharacter    pc  = new Objects.Mob.PlayerCharacter();

            GlobalReference.GlobalValues.Initilize();

            zone.Id    = 0;
            room.Id    = 0;
            item.Level = 3;
            zone.Rooms.Add(0, room);
            room.Items.Add(item);
            room.AddMobileObjectToRoom(npc);
            room.AddMobileObjectToRoom(pc);
            npc.Items.Add(item);
            npc.Level = 1;
            pc.Items.Add(item);
            pc.Level = 1;

            GlobalReference.GlobalValues.World.Zones.Add(0, zone);

            string serializedZone = GlobalReference.GlobalValues.Serialization.Serialize(zone);

            IZone zone2 = GlobalReference.GlobalValues.Serialization.Deserialize <Objects.Zone.Zone>(serializedZone);
            //temp work around room being added 2x
            IRoom room2;

            zone2.Rooms.TryGetValue(0, out room2);
            room2.KeyWords.RemoveAt(0);
            string serializedZone2 = GlobalReference.GlobalValues.Serialization.Serialize(zone2);

            Assert.AreEqual(serializedZone, serializedZone2);
        }