public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock<IDbSet<CharacterEnemyTeam>> mockSetCharacterEnemyTeams; var mockContext = CharacterEnemyTeamsMockingSetup.DoMockingSetupForContext(false, out mockSetCharacterEnemyTeams); var repository = new CharacterEnemyTeamsRepository(mockContext.Object); var characterEnemyTeams = new CharacterEnemyTeam { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(characterEnemyTeams); // Assert mockSetCharacterEnemyTeams.Verify(x => x.Add(characterEnemyTeams), Times.Once); }
public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock <IDbSet <CharacterEnemyTeam> > mockSetCharacterEnemyTeams; var mockContext = CharacterEnemyTeamsMockingSetup.DoMockingSetupForContext(false, out mockSetCharacterEnemyTeams); var repository = new CharacterEnemyTeamsRepository(mockContext.Object); var characterEnemyTeams = new CharacterEnemyTeam { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(characterEnemyTeams); // Assert mockSetCharacterEnemyTeams.Verify(x => x.Add(characterEnemyTeams), Times.Once); }
public void Verify_MapToEntity_WithExistingEntity_AssignsCharacterEnemyTeamProperties() { // Arrange var mapper = new CharacterEnemyTeamMapper(); var model = CharacterEnemyTeamsMockingSetup.DoMockingSetupForCharacterEnemyTeamModel(); // Act ICharacterEnemyTeam existingEntity = new CharacterEnemyTeam { Id = 1 }; mapper.MapToEntity(model.Object, ref existingEntity); // Assert // <None> // Related Objects Assert.Equal(model.Object.CharacterId, existingEntity.CharacterId); Assert.Equal(model.Object.EnemyTeamId, existingEntity.EnemyTeamId); // Associated Objects // <None> }