void Start()
    {
        _teamController = gameObject.GetComponent<TeamController>();

        if (StartingWeapon != null)
        {
            EquipWeapon(StartingWeapon);
        }
    }
        public async void AddMembersToTeam_Invalid_UserId_Or_TeamId()
        {
            //Given
            int         teamId = 0;
            List <User> users  = new List <User>();

            //When
            var controller = new TeamController(logger.Object, teamServiceMoq.Object);
            var response   = await controller.AddMembersToTeam(users, teamId) as BadRequestObjectResult;

            //Then
            Assert.IsType <BadRequestObjectResult>(response);
            Assert.Equal($"Invalid Users : {users} or TeamId : {teamId}", response.Value);
        }
Example #3
0
        public void TestValidateTeam_NullTeam()
        {
            //Arrange
            TeamController   teamController   = new TeamController();
            DatabaseProvider databaseProvider = new DatabaseProvider();
            ITeam            thisTeam         = new Team();
            ITeam            existingTeam     = databaseProvider.getTeam(thisTeam.TeamName);

            //Act
            bool valid = teamController.validateTeam(thisTeam, existingTeam);

            //Assert
            Assert.IsFalse(valid);
        }
Example #4
0
        public async Task GetTeamAsync_WithEmptyGuid_ReturnsBadRequest()
        {
            // Arrange
            var teamService = Substitute.For <ITeamService>();
            var controller  = new TeamController(teamService, orderByHelper, paginationHelper, mapper);

            // Act
            var result = await controller.GetTeamAsync(Guid.Empty);

            // Assert
            var badRequestResult = result as BadRequestResult;

            Assert.NotNull(badRequestResult);
        }
            public void Pod_Success()
            {
                // Given
                var fooAllocation = MockAllocation.GetTestAllocation();
                var fooProvider   = new AllocationProvider(fooAllocation);
                var fooController = new TeamController(fooProvider);
                // When
                var podRes = fooController.GetTeam(TeamType.A);
                // Then
                var jsonPodRes         = Assert.IsType <JsonResult>(podRes);
                var podSummaryResponse = Assert.IsType <TeamSummaryResponse>(jsonPodRes.Value);

                Assert.Equal(ResponseStatus.Success, podSummaryResponse.Status);
            }
Example #6
0
    //public GameObject AgentPrehab;

    void Start()
    {
        map          = GameObject.Find("map");
        game         = map.GetComponent <Game>();
        Team         = GameObject.Find("Team");
        tController  = Team.GetComponent <TeamController>();
        direction    = new float[2];
        distance     = new float[2];
        stickMin     = new float[2];
        direction[0] = -1f;
        //direction[1] = 1f;
        tagestick = new float[2];
        v         = 0.1f;
    }
        public void TeamController_Search_Post_NoResults()
        {
            //Arrange
            var mockTeamService = new MockTeamService().MockSearch(new List <Team>());

            var controller = new TeamController(mockTeamService.Object);

            //Act
            var result = controller.Search(new TeamSearch());

            //Assert
            Assert.IsAssignableFrom <RedirectToActionResult>(result);
            mockTeamService.VerifySearch(Times.Once());
        }
            public void ValidList_Success()
            {
                // Given
                var fooAllocation = MockAllocation.GetTestAllocation();
                var fooProvider   = new AllocationProvider(fooAllocation);
                var fooController = new TeamController(fooProvider);
                // When
                var res = fooController.GetTeamList();
                // Then
                var jsonResult       = Assert.IsType <JsonResult>(res);
                var teamListResponse = Assert.IsType <TeamListResponse>(jsonResult.Value);

                Assert.Equal(ResponseStatus.Success, teamListResponse.Status);
            }
 void CreateBasePlayers()
 {
     foreach (GameObject item in TeamController.GetInstance().LeagueDteams)
     {
         for (int i = 0; i < max_players; i++)
         {
             onePlayer.stregth    = Random.Range(30f, 100f);
             onePlayer.talent     = Random.Range(30f, 100f);
             onePlayer.playerName = generateName();
             item.GetComponent <Team>().Players.Add(onePlayer);
             onePlayer = new Player();
         }
     }
 }
    void Start()
    {
        photonView     = GetComponent <PhotonView>();
        camManager     = GetComponent <CameraManager>();
        masterPlayer   = PhotonNetwork.masterClient;
        playerStats    = PlayerStats.Instance;
        teamController = TeamController.Instance;
        chattingPanel  = ChattingPanel.Instance;
        objectPooler   = ObjectPooler.Instance;

        totalRoundGame = (int)PhotonNetwork.room.CustomProperties["Round"];
        matchPoint     = totalRoundGame / 2;
        winPoint       = matchPoint + 1;
    }
Example #11
0
    public override bool IsMet(GameObject agent)
    {
        AgentController controller = agent.GetComponent <AgentController>();

        if (controller.teamLeader == null)
        {
            return(false);
        }

        GameObject     childAI = TD_Utility.Utility.GetChildByTag(controller.teamLeader, Constants.AITag);
        TeamController teamCon = childAI.GetComponent <TeamController>();

        return(teamCon.IsInFront(agent));
    }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void InitWindowFluctuation(object sender, DirectEventArgs e)
        {
            if (!int.TryParse(hdfKeyRecord.Text, out var id) || id <= 0)
            {
                return;
            }
            var recordId = int.Parse(hdfRecordId.Text);
            var hs       = RecordController.GetById(recordId);
            var hsTeam   = TeamController.GetByRecordId(recordId);

            if (hs != null)
            {
                cbxChonCanBo.SelectedItem.Text = hs.FullName;
                txtEmployeeCode.Text           = hs.EmployeeCode;
                txtDepartment.Text             = hs.DepartmentName;
                txtBirthDate.Text = hs.BirthDateVn;
                txtPosition.Text  = hs.PositionName;
                txtJobTitle.Text  = hs.JobTitleName;
                txtIDNumber.Text  = hs.IDNumber;
                if (hs.IDIssueDate != null)
                {
                    txtIDIssueDate.SelectedDate = (DateTime)hs.IDIssueDate;
                }
            }

            if (hsTeam == null)
            {
                return;
            }
            txtTeam.Text         = hsTeam.TeamName;
            txtConstruction.Text = hsTeam.ConstructionName;
            var fluc = hr_FluctuationEmployeeServices.GetById(Convert.ToInt32(hdfKeyRecord.Text));

            txtReason.Text       = fluc.Reason;
            txtDate.SelectedDate = fluc.Date;
            if (fluc.Type == false)
            {
                rbIncrease.Checked = true;
            }
            else
            {
                rbDecrease.Checked = true;
            }

            wdCreateFluctuation.Title = @"Cập nhật quyết định tăng giảm nhân sự";
            wdCreateFluctuation.Show();
            hdfCommandName.Text = @"Update";
            hdfChonCanBo.Text   = hsTeam.RecordId.ToString();
        }
Example #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void InitWindowFluctuation(object sender, DirectEventArgs e)
        {
            if (!int.TryParse(hdfKeyRecord.Text, out var id) || id <= 0)
            {
                return;
            }
            var recordId   = int.Parse(hdfRecordId.Text);
            var hs         = RecordController.GetById(recordId);
            var hsTeam     = TeamController.GetByRecordId(recordId);
            var hsSalary   = SalaryDecisionController.GetCurrent(recordId);
            var hsContract = ContractController.GetByConditionRecord(recordId);

            if (hs != null)
            {
                cbxChonCanBo.SelectedItem.Text = hs.FullName;
                txtEmployeeCode.Text           = hs.EmployeeCode;
                txtDepartment.Text             = hs.DepartmentName;
                txtBirthDate.Text = hs.BirthDateVn;
                txtPosition.Text  = hs.PositionName;
            }

            txtTeam.Text            = hsTeam.TeamName;
            txtConstruction.Text    = hsTeam.ConstructionName;
            txtSalaryInsurance.Text = hsSalary.InsuranceSalary.ToString();
            txtInsuranceSubmit.Text = (hsSalary.InsuranceSalary * (decimal)0.32).ToString();
            txtContractNumber.Text  = hsContract.ContractNumber;
            if (hsContract.ContractDate != null)
            {
                txtContractDate.SelectedDate = (DateTime)hsContract.ContractDate;
            }
            if (hsContract.EffectiveDate != null)
            {
                txtEffectiveDate.SelectedDate = (DateTime)hsContract.EffectiveDate;
            }
            var fluc = hr_FluctuationInsuranceServices.GetById(Convert.ToInt32(hdfKeyRecord.Text));

            //txtReason.Text = fluc.Reason;
            //if(fluc.Type == false)
            //    rbIncrease.Checked = true;
            //else
            //{
            //    rbDecrease.Checked = true;
            //}

            wdCreateFluctuation.Title = @"Cập nhật quyết định tăng giảm BHXH, BHYT, BHTN";
            wdCreateFluctuation.Show();
            hdfCommandName.Text = @"Update";
            hdfChonCanBo.Text   = hsTeam.RecordId.ToString();
        }
Example #14
0
    public void OnEnable()
    {
        //Debug.Log ("Team dropdown refreshed");
        TeamController.RefreshTeams(TeamDropdown);
        if (currentObject != null)
        {
            RefreshUI();
        }

        if (!NetworkManager.NetworkInstance.IsServer)
        {
            EditButton.interactable  = false;
            StoreButton.interactable = false;
        }
    }
Example #15
0
 public TeamControllerTests()
 {
     mockTeamService   = new Mock <ITeamService>();
     mockLoggerService = new Mock <ILogger>();
     mockHttpRequest   = new Mock <HttpRequest>();
     mockHttpContext   = new Mock <HttpContext>();
     mockHttpContext.Setup(x => x.Request).Returns(mockHttpRequest.Object);
     TeamController = new TeamController(mockTeamService.Object, mockLoggerService.Object)
     {
         ControllerContext = new ControllerContext()
         {
             HttpContext = mockHttpContext.Object
         }
     };
 }
Example #16
0
 public Application(
     BaseGameController baseGameController,
     TeamController teamController,
     PersonController personController,
     SupplierController supplierController,
     TrackController trackController,
     PerformanceCurveController performanceCurveController)
 {
     _baseGameController         = baseGameController ?? throw new ArgumentNullException(nameof(baseGameController));
     _teamController             = teamController ?? throw new ArgumentNullException(nameof(teamController));
     _personController           = personController ?? throw new ArgumentNullException(nameof(personController));
     _supplierController         = supplierController ?? throw new ArgumentNullException(nameof(supplierController));
     _trackController            = trackController ?? throw new ArgumentNullException(nameof(trackController));
     _performanceCurveController = performanceCurveController ?? throw new ArgumentNullException(nameof(performanceCurveController));
 }
Example #17
0
 private void RadButton1_Click(object sender, EventArgs e)
 {
     if (COMBO_TEAM2.Text.Length > 0)
     {
         TeamController team = new TeamController();
         TEAMPIC2.Image      = team.Getpic(int.Parse(COMBO_TEAM2.Text.Trim()));
         COMBO_LIG2.Enabled  = false;
         COMBO_TEAM2.Enabled = false;
         radButton1.Visible  = false;
     }
     else
     {
         RadMessageBox.Show("تیم را ایتدا انتخاب کنید", "هشدار", MessageBoxButtons.OK, RadMessageIcon.Exclamation);
     }
 }
        public async void GetAllTeams_NotFound()
        {
            //Given
            int tenantId             = 100;
            IEnumerable <Team> teams = null;

            teamServiceMoq.Setup(e => e.GetAllTeams(tenantId)).ReturnsAsync(teams);

            //When
            var controller = new TeamController(logger.Object, teamServiceMoq.Object);
            var response   = await controller.GetAllTeams(tenantId) as NotFoundObjectResult;

            //Then
            Assert.IsType <NotFoundObjectResult>(response);
            Assert.Equal($"No teams found for the tenantId : {tenantId}", response.Value);
        }
Example #19
0
        public async void Get_Not_Exists()
        {
            TeamControllerMockFacade mock = new TeamControllerMockFacade();

            mock.ServiceMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <ApiTeamResponseModel>(null));
            TeamController controller = new TeamController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object);

            controller.ControllerContext             = new ControllerContext();
            controller.ControllerContext.HttpContext = new DefaultHttpContext();

            IActionResult response = await controller.Get(default(int));

            response.Should().BeOfType <StatusCodeResult>();
            (response as StatusCodeResult).StatusCode.Should().Be((int)HttpStatusCode.NotFound);
            mock.ServiceMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Example #20
0
    private void CmdVolley()
    {
        TeamController myTeamController = GameObject.FindGameObjectWithTag(GameController.GAME_CONTROLLER_TAG).GetComponent <GameController>().GetMyTeamController(id);

        if (myTeamController.CurrentTime > myTeamController.EndOfCoolDown)
        {
            bool successfulPurchase = myTeamController.SpendGold(Params.DESTROY_COST);
            if (successfulPurchase)
            {
                RpcClientPlaySingleSound(Params.VOLLEY);
                myTeamController.UpdateCoolDown();
                GameObject[] troops = GetTroopsInLane(opponentsTeamId, laneId).ToArray();
                RpcShootVolley(troops);
            }
        }
    }
Example #21
0
    public void InformAboutDeath(TeamController member)
    {
        if (member.agentCon.gameObject.tag == Constants.MercenaryTag)
        {
            return;
        }

        member.formCon.RemoveFromFormation(member.agentCon.gameObject);
        member.formCon.UpdateFormation();

        if (member.isTeamLeader && teamMembers.Count > 1)
        {
            NominateNextTeamleader();
            TransferFormation(teamLeader);
        }
    }
Example #22
0
    void LateUpdate()
    {
        if (IsDead())
        {
            gameObject.SetActive(false);

            if (gameObject.tag != Constants.MinionTag)
            {
                return;
            }

            TeamController member = TD_Utility.Utility.GetChildByTag(gameObject, Constants.AITag).GetComponent <TeamController>();
            TeamController leader = TD_Utility.Utility.GetChildByTag(teamLeader, Constants.AITag).GetComponent <TeamController>();
            leader.InformAboutDeath(member);
        }
    }
        public void TestThatCreatingANewTeamIsAllowed()
        {
            TeamController teamController = new TeamController(_teamRepository, _assessmentRepo, _dimensionRepo);

            teamController.Request = _request;

            Core.Models.Team newTeam = new Core.Models.Team()
            {
                Name = Guid.NewGuid().ToString()
            };

            IHttpActionResult result = teamController.Post(newTeam);

            //Assert.IsTrue(result.StatusCode == System.Net.HttpStatusCode.Created);
            Assert.IsTrue(_mockContainer.Teams.Where(i => i.Name == newTeam.Name).Count() == 1);
        }
Example #24
0
    private void FindTeamMembers(AgentSensor sensor)
    {
        if (teamMembers.Count != 0)
        {
            ResetTeam();
        }

        List <GameObject> allies = sensor.GetAllies();

        foreach (GameObject go in allies)
        {
            GameObject     child      = TD_Utility.Utility.GetChildByTag(go, Constants.TeamTag);
            TeamController controller = child.GetComponent <TeamController>();
            teamMembers.Add(controller);
        }
    }
Example #25
0
 protected void Fetch_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(TeamIDArg.Text))
     {
         MessageLabel.Text = "";
     }
     else
     {
         int teamid;
         if (int.TryParse(TeamIDArg.Text, out teamid))
         {
             if (teamid > 0)
             {
                 TeamController sysmgr = new TeamController();
                 Team           info   = null;
                 info = sysmgr.Teams_FindByID(teamid);
                 if (info == null)
                 {
                     MessageLabel.Text   = "No information for team can be retrieved / does not exist.";
                     TeamID.Text         = "";
                     TeamName.Text       = "";
                     Coach.Text          = "";
                     AssistantCoach.Text = "";
                     Wins.Text           = "";
                     Losses.Text         = "";
                 }
                 else
                 {
                     TeamID.Text         = info.TeamID.ToString();
                     TeamName.Text       = info.TeamName;
                     Coach.Text          = info.Coach;
                     AssistantCoach.Text = info.AssistantCoach;
                     Wins.Text           = info.Wins.ToString();
                     Losses.Text         = info.Losses.ToString();
                 }
             }
             else
             {
                 MessageLabel.Text = "Team ID must be greater than 0.";
             }
         }
         else
         {
             MessageLabel.Text = "Team ID must be a number.";
         }
     }
 }
Example #26
0
        public void TestGetEmployeeTeamsByTeamID()
        {
            // db is empty
            using (var context = new ProTickDatabaseContext(dbOptions))
            {
                var dbm       = new DatabaseQueryManager(context);
                var converter = new ResourceDTOConverter(dbm);

                var controller = new TeamController(context, converter, dbm);

                var actual = controller.GetEmployeeTeamsByTeamID(0).ToList().Count;

                int expected = 0;

                Assert.Equal(expected, actual);
            }

            // seeding DB
            using (var context = new ProTickDatabaseContext(dbOptions))
            {
                DbContextSeeder.SeedFull(context);
            }

            // db is Test-Ready
            using (var context = new ProTickDatabaseContext(dbOptions))
            {
                var dbm       = new DatabaseQueryManager(context);
                var converter = new ResourceDTOConverter(dbm);

                var controller = new TeamController(context, converter, dbm);

                var expected = DbContextSeeder.GetSeededEmployeeTeamDTOs(
                    3,
                    DbContextSeeder.GetSeededEmployeeDTOs(
                        3,
                        DbContextSeeder.GetSeededAddressDTOs(3),
                        DbContextSeeder.GetSeededRoleDTOs(3)
                        ),
                    DbContextSeeder.GetSeededTeamDTOs(3)
                    )
                               .ToList();

                expected[0].Should().BeEquivalentTo(controller.GetEmployeeTeamsByTeamID(1).ToList()[0]);
                expected[1].Should().BeEquivalentTo(controller.GetEmployeeTeamsByTeamID(2).ToList()[0]);
                expected[2].Should().BeEquivalentTo(controller.GetEmployeeTeamsByTeamID(3).ToList()[0]);
            }
        }
Example #27
0
        protected void Search_Click(object sender, EventArgs e)
        {
            if (TeamList.SelectedIndex == 0)
            {
                MessageLabel.Text = "Select a team to view its roster.";
            }
            else
            {
                int teamid = int.Parse(TeamList.SelectedValue);

                try
                {
                    TeamController teamMgr  = new TeamController();
                    Team           teamInfo = null;
                    teamInfo = teamMgr.Team_Find(teamid);

                    if (teamInfo == null)
                    {
                        MessageLabel.Text   = "Team not found.";
                        Coach.Text          = "";
                        AssistantCoach.Text = "";
                        Wins.Text           = "";
                        Losses.Text         = "";
                    }
                    else
                    {
                        Coach.Text          = teamInfo.Coach;
                        AssistantCoach.Text = teamInfo.AssistantCoach;
                        Wins.Text           = teamInfo.Wins.ToString() == "" ? "0" : teamInfo.Wins.ToString();
                        Losses.Text         = teamInfo.Losses.ToString() == "" ? "0" : teamInfo.Losses.ToString();
                    }

                    PlayerController playerMgr = new PlayerController();
                    List <Player>    info      = null;

                    info = playerMgr.Player_GetByTeam(teamid);
                    info.Sort((x, y) => x.LastName.CompareTo(y.LastName));
                    TeamRoster.DataSource = info;

                    TeamRoster.DataBind();
                }
                catch (Exception ex)
                {
                    MessageLabel.Text = ex.Message;
                }
            }
        }
        public async void RemoveTeamUsers_NotFound()
        {
            //Given
            int  teamId = 10, userId = 1;
            bool isUserRemoved = false;

            teamServiceMoq.Setup(e => e.RemoveUserFromTeam(teamId, userId)).ReturnsAsync(isUserRemoved);

            //When
            var controller = new TeamController(logger.Object, teamServiceMoq.Object);
            var response   = await controller.RemoveTeamUsers(teamId, userId) as NotFoundObjectResult;

            //Then
            Assert.IsType <NotFoundObjectResult>(response);
            Assert.Equal($"No User found for the teamId : {teamId} to remove", response.Value);
            teamServiceMoq.Verify(e => e.RemoveUserFromTeam(teamId, userId), Times.Once);
        }
        private void OnValidate()
        {
            if (_weaponController == null)
            {
                _weaponController = GetComponentInChildren <NullWeaponController>();
            }

            if (_hittableObject == null)
            {
                _hittableObject = GetComponentInChildren <HittableObject>();
            }

            if (_teamController == null)
            {
                _teamController = GetComponentInChildren <TeamController>();
            }
        }
Example #30
0
        public void TestPutTeam()
        {
            // seeding DB
            using (var context = new ProTickDatabaseContext(dbOptions))
            {
                DbContextSeeder.SeedFull(context);
            }

            // db is Test-Ready
            using (var context = new ProTickDatabaseContext(dbOptions))
            {
                var dbm       = new DatabaseQueryManager(context);
                var converter = new ResourceDTOConverter(dbm);

                var controller = new TeamController(context, converter, dbm);

                var dtos = DbContextSeeder.GetSeededTeamDTOs(
                    3
                    )
                           .ToList();

                var expectedText = "test";
                var expectedID   = 1;

                dtos[2].Abbreviation = expectedText;
                dtos[2].Description  = expectedText;

                var actual = controller.PutTeam(3, dtos[2]);

                actual.Should().BeEquivalentTo(dtos[2]);

                var actualCount = context.Team.ToList().Count;
                Assert.Equal(3, actualCount);

                var team = context.Team
                           .FirstOrDefault(x => x.TeamID == 3);

                Assert.True(team != null);

                if (team != null)
                {
                    Assert.Equal(team.Description, expectedText);
                    Assert.Equal(team.Abbreviation, expectedText);
                }
            }
        }
        public void TestThatCreatingADuplicateTeamThrowsException()
        {
            _mockContainer.Teams.Add(new Data.Team()
            {
                Name = "Test Team"
            });

            TeamController teamController = new TeamController(_teamRepository, _assessmentRepo, _dimensionRepo);

            Core.Models.Team newTeam = new Core.Models.Team()
            {
                Name = _mockContainer.Teams.First().Name
            };

            teamController.Post(newTeam);
            Assert.Fail("Must not create duplicate teams");
        }
    public void Start()
    {
        // Components
        _rb = GetComponent<Rigidbody>();
        _input = GetComponent<IInputReceiver>();
        _weaponController = GetComponent<WeaponController>();
        _transf = transform;
        //_mat = MeshRender.material;
        _animator = GetComponentInChildren<Animator>();
        _teamC = GetComponent<TeamController>();

        // Colorize
        //_mat.color = PlayerColor;

        //
        _prevForward = _transf.forward;
    }
        void Awake()
        {
            m_GlobalGameManager = GlobalGameManager.Instance;

            m_GameController = FindObjectOfType<GameController>();

            m_SoundController = GetComponent<SoundController>();

            m_TeamController = transform.parent.GetComponent<TeamController>();
        }
Example #34
0
    // Use this for initialization
    void Start()
    {
        teamController = transform.GetComponentInChildren<TeamController>();
        team = teamController.team;
        maxTeamCount = maxFigtherPerSquad + maxFrigatePerSquad + maxDestroyerPerSquad;

        if (ExtendedNetworkManager.isHost)
        {
            StartSpawning();
            GameLevelEventManager.ShipDestroyedEvent += TrackShipDestruction;
        }
    }
 void Awake()
 {
     m_TeamController = transform.parent.GetComponent<TeamController>();
 }
Example #36
0
 /// <summary>
 /// Set the team controller so this ship can communicate
 /// with the rest of the team
 /// </summary>
 /// <param name="controller"></param>
 public void SetTeamController(TeamController controller)
 {
     teamController = controller;
 }
Example #37
0
 void Awake()
 {
     GC = GameController.GetComponent<TeamController>();
 }