Player() public method

public Player ( ) : Mock
return Mock
Beispiel #1
0
        public static Mocks Init()
        {
            ContainerBuilder builder = new ContainerBuilder();
            Mocks            mocks   = new Mocks();

            builder.RegisterInstance(mocks.Animation().Object);
            builder.RegisterInstance(mocks.AnimationState().Object);
            builder.RegisterInstance(mocks.GameState().Object);
            builder.RegisterInstance(mocks.Game().Object);
            builder.RegisterInstance(mocks.Player().Object);
            builder.RegisterInstance(mocks.Character().Object);
            builder.RegisterInstance(mocks.Room().Object);
            builder.RegisterInstance(mocks.Object().Object);
            builder.RegisterInstance(mocks.Viewport().Object);
            builder.RegisterInstance(mocks.Sprite().Object);
            builder.RegisterInstance(mocks.Image().Object);
            builder.RegisterInstance(mocks.Input().Object);
            builder.RegisterInstance(mocks.Cutscene().Object);
            builder.RegisterInstance(mocks.RoomTransitions().Object);
            builder.RegisterInstance(mocks.AudioSystem().Object);
            builder.RegisterInstance(new Mock <IRenderMessagePump> ().Object);
            builder.RegisterInstance(new Mock <IUpdateMessagePump>().Object);
            builder.RegisterInstance(new Mock <IGameEvents>().Object);
            builder.RegisterInstance(new Mock <IDisplayList>().Object);
            builder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource());

            mocks.container = builder.Build();

            return(mocks);
        }
Beispiel #2
0
        public async Task ChangeRoom_WhenInRoom_Test()
        {
            Mock <IGameState>      state = _mocks.GameState();
            AGSBindingList <IRoom> rooms = new AGSBindingList <IRoom> (10);

            state.Setup(s => s.Rooms).Returns(rooms);
            state.Setup(s => s.Player).Returns(_mocks.Player().Object);

            foreach (IObject obj in GetImplementors(_mocks, state))
            {
                rooms.Clear();
                IRoom oldRoom = _mocks.Room(true).Object;
                IRoom newRoom = _mocks.Room(true).Object;
                rooms.Add(oldRoom);
                rooms.Add(newRoom);
                await testChangeRoom(obj, oldRoom, newRoom);
            }
        }
Beispiel #3
0
        public async Task ChangeRoom_WhenInRoom_Test()
        {
            Mock <IGameState>      state = _mocks.GameState();
            AGSBindingList <IRoom> rooms = new AGSBindingList <IRoom> (10);

            state.Setup(s => s.Rooms).Returns(rooms);
            state.Setup(s => s.Player).Returns(_mocks.Player().Object);

            foreach (IObject obj in GetImplementors(_mocks, state))
            {
                rooms.Clear();
                IRoom oldRoom = _mocks.Room(true).Object;
                IRoom newRoom = _mocks.Room(true).Object;
                rooms.Add(oldRoom);
                rooms.Add(newRoom);
                await obj.ChangeRoomAsync(oldRoom);

                await obj.ChangeRoomAsync(newRoom);

                Assert.AreEqual(newRoom, obj.Room, "Room not changed for " + obj.Hotspot ?? "null");
                Assert.AreEqual(oldRoom, obj.PreviousRoom, "Prev room incorrect for " + obj.Hotspot ?? "null");
            }
        }