public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock<IDbSet<TeamMember>> mockSetTeamMembers; var mockContext = TeamMembersMockingSetup.DoMockingSetupForContext(true, out mockSetTeamMembers); var repository = new TeamMembersRepository(mockContext.Object); var teamMembers = repository.Get(1); // Act repository.Deactivate(teamMembers); // Assert Assert.Equal(false, teamMembers.Active); }
public void Verify_Get_ByKey_Should_ReturnTheCorrectTeamMember() { // Arrange Mock <IDbSet <TeamMember> > mockSetTeamMembers; var mockContext = TeamMembersMockingSetup.DoMockingSetupForContext(true, out mockSetTeamMembers); var repository = new TeamMembersRepository(mockContext.Object); // Act var teamMembers = repository.Get("KING-STEPHEN"); // Assert Assert.Equal("/TEST/KING-STEPHEN", teamMembers.ApiDetailUrl); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock <IDbSet <TeamMember> > mockSetTeamMembers; var mockContext = TeamMembersMockingSetup.DoMockingSetupForContext(true, out mockSetTeamMembers); var repository = new TeamMembersRepository(mockContext.Object); var teamMembers = repository.Get(1); // Act repository.Deactivate(teamMembers); // Assert Assert.Equal(false, teamMembers.Active); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock <IDbSet <TeamMember> > mockSetTeamMembers; var mockContext = TeamMembersMockingSetup.DoMockingSetupForContext(true, out mockSetTeamMembers); var repository = new TeamMembersRepository(mockContext.Object); var teamMembers = repository.Get(1); // Act repository.Remove(teamMembers); // Assert mockSetTeamMembers.Verify(x => x.Remove((TeamMember)teamMembers), Times.Once); }
public ActionResult Detail(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var teamMember = _teamMembersRepository.Get((int)id); if (teamMember == null) { return(HttpNotFound()); } // Sort the teams. teamMember.Teams = teamMember.Teams .OrderBy(t => t.Team.Event.Title) .OrderByDescending(t => t.Team.TeamName) .ToList(); 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); }
public void Verify_Get_ByID_Should_ReturnTheCorrectTeamMember() { // Arrange Mock<IDbSet<TeamMember>> mockSetTeamMembers; var mockContext = TeamMembersMockingSetup.DoMockingSetupForContext(true, out mockSetTeamMembers); var repository = new TeamMembersRepository(mockContext.Object); // Act var teamMembers = repository.Get(1); // Assert Assert.Equal("/TEST/KING-STEPHEN", teamMembers.ApiDetailUrl); }
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 void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock<IDbSet<TeamMember>> mockSetTeamMembers; var mockContext = TeamMembersMockingSetup.DoMockingSetupForContext(true, out mockSetTeamMembers); var repository = new TeamMembersRepository(mockContext.Object); var teamMembers = repository.Get(1); // Act repository.Remove(teamMembers); // Assert mockSetTeamMembers.Verify(x => x.Remove((TeamMember)teamMembers), Times.Once); }