public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock<IDbSet<CharacterDiedInIssue>> mockSetCharacterDiedInIssues; var mockContext = CharacterDiedInIssuesMockingSetup.DoMockingSetupForContext(false, out mockSetCharacterDiedInIssues); var repository = new CharacterDiedInIssuesRepository(mockContext.Object); var characterDiedInIssues = new CharacterDiedInIssue { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(characterDiedInIssues); // Assert mockSetCharacterDiedInIssues.Verify(x => x.Add(characterDiedInIssues), Times.Once); }
public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock <IDbSet <CharacterDiedInIssue> > mockSetCharacterDiedInIssues; var mockContext = CharacterDiedInIssuesMockingSetup.DoMockingSetupForContext(false, out mockSetCharacterDiedInIssues); var repository = new CharacterDiedInIssuesRepository(mockContext.Object); var characterDiedInIssues = new CharacterDiedInIssue { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(characterDiedInIssues); // Assert mockSetCharacterDiedInIssues.Verify(x => x.Add(characterDiedInIssues), Times.Once); }
public void Verify_MapToEntity_WithExistingEntity_AssignsCharacterDiedInIssueProperties() { // Arrange var mapper = new CharacterDiedInIssueMapper(); var model = CharacterDiedInIssuesMockingSetup.DoMockingSetupForCharacterDiedInIssueModel(); // Act ICharacterDiedInIssue existingEntity = new CharacterDiedInIssue { Id = 1 }; mapper.MapToEntity(model.Object, ref existingEntity); // Assert // <None> // Related Objects Assert.Equal(model.Object.CharacterId, existingEntity.CharacterId); Assert.Equal(model.Object.DiedInIssueId, existingEntity.DiedInIssueId); // Associated Objects // <None> }