예제 #1
0
        public void Should_return_all_exits()
        {
            _room = new GameLogic.World.Room.Room()
            {
                Exits = new ExitDirections()
                {
                    NorthWest = new Exit()
                    {
                        Name = " North West",
                        Door = false,
                    },

                    North = new Exit()
                    {
                        Name = " North",
                        Door = false,
                    },
                    NorthEast = new Exit()
                    {
                        Name = " North East",
                        Door = false,
                    },
                    East = new Exit()
                    {
                        Name = " East",
                        Door = false,
                    },
                    SouthEast = new Exit()
                    {
                        Name = " South East",
                        Door = false,
                    },
                    South = new Exit()
                    {
                        Name = " South",
                        Door = false,
                    },
                    SouthWest = new Exit()
                    {
                        Name = " South West",
                        Door = false,
                    },
                    West = new Exit()
                    {
                        Name = " West",
                        Door = false,
                    },
                }
            };

            var exits = new RoomActions(_writer.Object, _time.Object).FindValidExits(_room);

            Assert.Equal(" North West,  North,  North East,  East,  South East,  South,  South West,  West", exits);
        }
예제 #2
0
 public RoomsViewModel(account cont)
 {
     _cont   = cont;
     actions = new RoomActions(); if (cont.userType == "Admin")
     {
         IsAdmin = "Visible";
     }
     else
     {
         IsAdmin = "Hidden";
     }
 }
예제 #3
0
        public void Should_return_none_exits()
        {
            _room = new GameLogic.World.Room.Room()
            {
                Exits = new ExitDirections()
                {
                }
            };

            var exits = new RoomActions(_writer.Object).FindValidExits(_room);

            Assert.Equal("None", exits);
        }
예제 #4
0
        public void Should_return_none_exits()
        {
            _room = new GameLogic.World.Room.Room()
            {
                Exits = new ExitDirections()
                {
                }
            };

            var exits = new RoomActions(_writer.Object, _time.Object, _cache.Object, _dice.Object, _gain.Object, _formulas.Object).FindValidExits(_room, false);

            Assert.Equal("None", exits);
        }
예제 #5
0
        public void Should_return_east_exits()
        {
            _room = new GameLogic.World.Room.Room()
            {
                Exits = new ExitDirections()
                {
                    East = new Exit()
                    {
                        Name = "East"
                    }
                }
            };

            var exits = new RoomActions(_writer.Object).FindValidExits(_room);

            Assert.Equal("East", exits);
        }
예제 #6
0
        public void Should_return_custom_exits()
        {
            _room = new GameLogic.World.Room.Room()
            {
                Exits = new ExitDirections()
                {
                    NorthWest = new Exit()
                    {
                        Name = "A hole in the wall"
                    }
                }
            };

            var exits = new RoomActions(_writer.Object).FindValidExits(_room);

            Assert.Equal("A hole in the wall", exits);
        }
예제 #7
0
        public Room ConstructRoom(int id)
        {
            string model = RoomActions.GetRoomModelFromRoomId(id);

            if (!_modelTypeLookup.ContainsKey(model))
            {
                FindNewModelTypes();
            }
            if (!_modelTypeLookup.ContainsKey(model))
            {
                throw new Exception(CoreManager.ServerCore.StringLocale.GetString("CORE:ERROR_ROOM_MODEL_MISSING", model));
            }

            Type modelType = _modelTypeLookup[model];

            return((Room)Activator.CreateInstance(modelType, new object[] { id })); // This might be slow. Keep that in mind if performance becomes a problem.
        }
예제 #8
0
        public void Should_return_northEast_exits()
        {
            _room = new GameLogic.World.Room.Room()
            {
                Exits = new ExitDirections()
                {
                    NorthEast = new Exit()
                    {
                        Name = "North East",
                        Door = false,
                    }
                }
            };

            var exits = new RoomActions(_writer.Object, _time.Object).FindValidExits(_room);

            Assert.Equal("North East", exits);
        }
예제 #9
0
        public void Should_return_south_west_exits()
        {
            _room = new GameLogic.World.Room.Room()
            {
                Exits = new ExitDirections()
                {
                    SouthWest = new Exit()
                    {
                        Name = "South West",
                        Door = false,
                    }
                }
            };

            var exits = new RoomActions(_writer.Object, _time.Object, _cache.Object).FindValidExits(_room, false);

            Assert.Equal("South West", exits);
        }
예제 #10
0
        public void Should_return_custom_exits()
        {
            _room = new GameLogic.World.Room.Room()
            {
                Exits = new ExitDirections()
                {
                    NorthWest = new Exit()
                    {
                        Name = "A hole in the wall",
                        Door = false,
                    }
                }
            };

            var exits = new RoomActions(_writer.Object, _time.Object, _cache.Object, _dice.Object, _gain.Object, _formulas.Object).FindValidExits(_room, false);

            Assert.Equal("A hole in the wall", exits);
        }
예제 #11
0
        public void Should_return_east_exits()
        {
            _room = new GameLogic.World.Room.Room()
            {
                Exits = new ExitDirections()
                {
                    East = new Exit()
                    {
                        Name   = "East",
                        Door   = false,
                        Coords = new Coordinates()
                    }
                }
            };

            var exits = new RoomActions(_writer.Object, _time.Object, _cache.Object, _dice.Object, _gain.Object, _formulas.Object).FindValidExits(_room, false);

            Assert.Equal("East", exits);
        }
예제 #12
0
        public FormRoomViewModel(account cont, room room)
        {
            _cont = cont;

            _room         = room;
            Capacity      = room.capacity.ToString();
            Price         = room.price.ToString();
            NumberOfRooms = room.numberofrooms.ToString();
            Visible       = "Visible";
            if (cont.userType == "Admin")
            {
                IsAdmin = "Visible";
            }
            else
            {
                IsAdmin = "Hidden";
            }

            actions = new RoomActions();
        }
예제 #13
0
 public FormRoomViewModel()
 {
     actions = new RoomActions();
     Visible = "Hidden";
 }
예제 #14
0
 public RoomActionModel(RoomActions command, Room room)
 {
     Command = command;
     Room    = room;
 }
예제 #15
0
        public void Should_return_all_exits()
        {
            _room = new GameLogic.World.Room.Room()
            {
                Exits = new ExitDirections()
                {
                    NorthWest = new Exit()
                    {
                        Name   = " North West",
                        Door   = false,
                        Coords = new Coordinates()
                    },

                    North = new Exit()
                    {
                        Name   = " North",
                        Door   = false,
                        Coords = new Coordinates()
                    },
                    NorthEast = new Exit()
                    {
                        Name   = " North East",
                        Door   = false,
                        Coords = new Coordinates()
                    },
                    East = new Exit()
                    {
                        Name   = " East",
                        Door   = false,
                        Coords = new Coordinates()
                    },
                    SouthEast = new Exit()
                    {
                        Name   = " South East",
                        Door   = false,
                        Coords = new Coordinates()
                    },
                    South = new Exit()
                    {
                        Name   = " South",
                        Door   = false,
                        Coords = new Coordinates()
                    },
                    SouthWest = new Exit()
                    {
                        Name   = " South West",
                        Door   = false,
                        Coords = new Coordinates()
                    },
                    West = new Exit()
                    {
                        Name   = " West",
                        Door   = false,
                        Coords = new Coordinates()
                    },
                }
            };

            var exits = new RoomActions(_writer.Object, _time.Object, _cache.Object, _dice.Object, _gain.Object, _formulas.Object).FindValidExits(_room, false);

            Assert.Equal(" North,  East,  South,  West,  North East,  South East,  South West,  North West", exits);
        }