public void GetEntitiesReturnsCalled()
        {
            //Setup
            var mService = new Mock <IVisualizationService>();
            var mblob    = new Mock <IBlobService>();

            mService.Setup(mock => mock.GetEntities());

            //Action
            var controller = new VisualizationController(mService.Object, mblob.Object);

            controller.GetEntities();

            //Assert
            mService.Verify(mock => mock.GetEntities(), Times.Once);
        }
        public void DeleteEntityReturnsCalled()
        {
            //Setup
            var mService = new Mock <IVisualizationService>();
            var mblob    = new Mock <IBlobService>();

            mService.Setup(mock => mock.DeleteEntity(It.IsAny <int>()));

            //Action
            var controller = new VisualizationController(mService.Object, mblob.Object);

            controller.DeleteEntityById(It.IsAny <int>());

            //Assert
            mService.Verify(mock => mock.DeleteEntity(It.IsAny <int>()), Times.Once);
        }
        public async void CreateEntityReturnsCalled()
        {
            //Setup
            var item = new Mock <VisualizationDTO>();

            item.Object.Id      = It.IsAny <int>();
            item.Object.content = It.IsAny <string>();
            item.Object.FileUrl = It.IsAny <string>();

            var mService = new Mock <IVisualizationService>();
            var mblob    = new Mock <IBlobService>();

            mService.Setup(mock => mock.CreateEntity(item.Object, item.Object.content, It.IsAny <string>()));

            //Action
            var controller = new VisualizationController(mService.Object, mblob.Object);
            await controller.CreateEntity(item.Object, It.IsAny <string>());

            //Assert
            mService.Verify(mock => mock.CreateEntity(item.Object, item.Object.content, It.IsAny <string>()), Times.Once);
        }
Ejemplo n.º 4
0
    private GameObject CreateTestPlayer(int playerIndex)
    {
        NetworkViewID playerViewID  = Network.AllocateViewID();
        NetworkViewID pointerViewID = Network.AllocateViewID();

        // set the position based on the player index
        Vector3    initialLocation = m_playerSpawnTransforms[playerIndex].position;
        Quaternion initialRotation = m_playerSpawnTransforms[playerIndex].rotation;

        // create the player object
        GameObject player = Resources.Load("Player") as GameObject;

        player = Instantiate(player, initialLocation, initialRotation) as GameObject;

        // get the network view id from the player
        NetworkView playerNetworkView = player.GetComponent <NetworkView>();

        playerNetworkView.viewID = playerViewID;

        Wand playerWand = player.GetComponent <Wand>();
        PointerController pointerController  = playerWand.m_pointerController;
        NetworkView       pointerNetworkView = pointerController.gameObject.GetComponent <NetworkView>();

        pointerNetworkView.viewID = pointerViewID;

        // save a local reference to the player
        m_players[playerIndex] = player;

        // set the color and the name
        VisualizationController visualizationController = player.GetComponent <VisualizationController>();

        visualizationController.InitializeColors(m_playerColors[playerIndex]);
        player.name = playerIndex == 0 ? "HostPlayer" : "ClientPlayer";

        player.GetComponentInChildren <AttackAbility>().EnableAutoAttack();
        player.GetComponentInChildren <PointerController>().EnableAutoMove();

        return(player);
    }