Beispiel #1
0
        public void DevTeamService_PutDevTeam_ReturnsOk()
        {
            var devTeam = new DevTeamEdit {
                TeamId = 1, TeamName = "XML Team"
            };
            var result = _controller.Put(devTeam);

            Assert.AreEqual(1, _mockService.CallCount);
            Assert.IsInstanceOfType(result, typeof(OkResult));
        }
Beispiel #2
0
        public void DevTeamController_UpdateDevTeam_CountShouldBeCorrectInt()
        {
            var newDevTeam = new DevTeamEdit {
                TeamName = "Name"
            };

            var result = _controller.Put(newDevTeam);

            Assert.AreEqual(1, _mockService.CallCount);
            Assert.IsInstanceOfType(result, typeof(OkResult));
        }
Beispiel #3
0
        public bool UpdateDevTeam(DevTeamEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity = ctx
                             .DevTeams
                             .Single(e => e.TeamId == model.TeamId && e.OwnerId == _userId);
                entity.TeamId   = model.TeamId;
                entity.TeamName = model.TeamName;

                return(ctx.SaveChanges() == 1);
            }
        }
Beispiel #4
0
        public IHttpActionResult Put(DevTeamEdit devTeam)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (!_devTeamService.UpdateDevTeam(devTeam))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
 public bool UpdateDevTeam(DevTeamEdit model)
 {
     CallCount++;
     return(ReturnValue);
 }