public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock<IDbSet<CharacterIssue>> mockSetCharacterIssues; var mockContext = CharacterIssuesMockingSetup.DoMockingSetupForContext(false, out mockSetCharacterIssues); var repository = new CharacterIssuesRepository(mockContext.Object); var characterIssues = new CharacterIssue { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(characterIssues); // Assert mockSetCharacterIssues.Verify(x => x.Add(characterIssues), Times.Once); }
public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock <IDbSet <CharacterIssue> > mockSetCharacterIssues; var mockContext = CharacterIssuesMockingSetup.DoMockingSetupForContext(false, out mockSetCharacterIssues); var repository = new CharacterIssuesRepository(mockContext.Object); var characterIssues = new CharacterIssue { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(characterIssues); // Assert mockSetCharacterIssues.Verify(x => x.Add(characterIssues), Times.Once); }
public void Verify_MapToEntity_WithExistingEntity_AssignsCharacterIssueProperties() { // Arrange var mapper = new CharacterIssueMapper(); var model = CharacterIssuesMockingSetup.DoMockingSetupForCharacterIssueModel(); // Act ICharacterIssue existingEntity = new CharacterIssue { Id = 1 }; mapper.MapToEntity(model.Object, ref existingEntity); // Assert // <None> // Related Objects Assert.Equal(model.Object.CharacterId, existingEntity.CharacterId); Assert.Equal(model.Object.IssueId, existingEntity.IssueId); // Associated Objects // <None> }
public void Verify_MapToEntity_WithExistingEntity_AssignsCharacterIssueProperties() { // Arrange var mapper = new CharacterIssueMapper(); var model = CharacterIssuesMockingSetup.DoMockingSetupForCharacterIssueModel(); // Act ICharacterIssue existingEntity = new CharacterIssue { Id = 1 }; mapper.MapToEntity(model.Object, ref existingEntity); // Assert // <None> // Related Objects Assert.Equal(model.Object.CharacterId, existingEntity.CharacterId); Assert.Equal(model.Object.IssueId, existingEntity.IssueId); // Associated Objects // <None> }