public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock<IDbSet<TeamAlias>> mockSetTeamAliases; var mockContext = TeamAliasesMockingSetup.DoMockingSetupForContext(false, out mockSetTeamAliases); var repository = new TeamAliasesRepository(mockContext.Object); var teamAliases = new TeamAlias { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(teamAliases); // Assert mockSetTeamAliases.Verify(x => x.Add(teamAliases), Times.Once); }
public void Verify_MapToEntity_WithExistingEntity_AssignsTeamAliasProperties() { // Arrange var mapper = new TeamAliasMapper(); var model = TeamAliasesMockingSetup.DoMockingSetupForTeamAliasModel(); // Act ITeamAlias existingEntity = new TeamAlias { Id = 1 }; mapper.MapToEntity(model.Object, ref existingEntity); // Assert // <None> // Related Objects Assert.Equal(model.Object.TeamId, existingEntity.TeamId); // Associated Objects // <None> }
public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock <IDbSet <TeamAlias> > mockSetTeamAliases; var mockContext = TeamAliasesMockingSetup.DoMockingSetupForContext(false, out mockSetTeamAliases); var repository = new TeamAliasesRepository(mockContext.Object); var teamAliases = new TeamAlias { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(teamAliases); // Assert mockSetTeamAliases.Verify(x => x.Add(teamAliases), Times.Once); }
public void Verify_MapToEntity_WithExistingEntity_AssignsTeamAliasProperties() { // Arrange var mapper = new TeamAliasMapper(); var model = TeamAliasesMockingSetup.DoMockingSetupForTeamAliasModel(); // Act ITeamAlias existingEntity = new TeamAlias { Id = 1 }; mapper.MapToEntity(model.Object, ref existingEntity); // Assert // <None> // Related Objects Assert.Equal(model.Object.TeamId, existingEntity.TeamId); // Associated Objects // <None> }