Exemplo n.º 1
0
        public void Verify_Update_Should_SetTheEntityStateToModified()
        {
            // Arrange
            Mock <IDbSet <TeamMember> > mockSetTeamMembers;
            var mockContext = TeamMembersMockingSetup.DoMockingSetupForContext(true, out mockSetTeamMembers);
            var repository  = new TeamMembersRepository(mockContext.Object);
            var teamMembers = repository.Get(1);

            teamMembers.ApiDetailUrl = "/TEST";
            // Act
            repository.Update(teamMembers);
            // Assert
            mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once);
        }
        public ActionResult Edit(TeamMember teamMember)
        {
            ValidateTeamMember(teamMember);

            if (ModelState.IsValid)
            {
                _teamMembersRepository.Update(teamMember);

                TempData["Message"] = "Your team member was successfully updated!";

                return(RedirectToAction("Detail", new { id = teamMember.Id }));
            }

            return(View(teamMember));
        }
 public void Verify_Update_Should_SetTheEntityStateToModified()
 {
     // Arrange
     Mock<IDbSet<TeamMember>> mockSetTeamMembers;
     var mockContext = TeamMembersMockingSetup.DoMockingSetupForContext(true, out mockSetTeamMembers);
     var repository = new TeamMembersRepository(mockContext.Object);
     var teamMembers = repository.Get(1);
     teamMembers.ApiDetailUrl = "/TEST";
     // Act
     repository.Update(teamMembers);
     // Assert
     mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once);
 }