private void ValidAllocation_Ok() { // Given var fooAllocation = MockAllocation.GetTestAllocation(); var fooProvider = new AllocationProvider(fooAllocation); var fooController = new TeamController(fooProvider); var fooNewSeniorAllocation = new SeniorAllocationRequest(MockSeniorTeam.GetMutantSeniorTeam().AsSeniorTeam); // When var seniorRes = fooController.AddAllocationToSeniorTeam(fooNewSeniorAllocation); // Then Assert.IsType <OkObjectResult>(seniorRes); }
public IActionResult AddAllocationToSeniorTeam([FromBody] SeniorAllocationRequest seniorAllocation) { if (seniorAllocation == null) { return(BadRequest(new ErrorResponse("Bad or invalid request body"))); } if (!seniorAllocation.SeniorTeam.IsStateValid) { return(BadRequest(new ErrorResponse("Invalid senior team allocation supplied. No changes were saved"))); } _allocation.SetSeniorTeam(seniorAllocation.SeniorTeam); _allocation.Commit(TeamType.Senior); return(Ok(new AllocationResponse(_allocation.SeniorTeam))); }