public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock<IDbSet<ConceptAppearedInIssue>> mockSetConceptAppearedInIssues; var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(false, out mockSetConceptAppearedInIssues); var repository = new ConceptAppearedInIssuesRepository(mockContext.Object); var conceptAppearedInIssues = new ConceptAppearedInIssue { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(conceptAppearedInIssues); // Assert mockSetConceptAppearedInIssues.Verify(x => x.Add(conceptAppearedInIssues), Times.Once); }
public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock <IDbSet <ConceptAppearedInIssue> > mockSetConceptAppearedInIssues; var mockContext = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForContext(false, out mockSetConceptAppearedInIssues); var repository = new ConceptAppearedInIssuesRepository(mockContext.Object); var conceptAppearedInIssues = new ConceptAppearedInIssue { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(conceptAppearedInIssues); // Assert mockSetConceptAppearedInIssues.Verify(x => x.Add(conceptAppearedInIssues), Times.Once); }
public void Verify_MapToEntity_WithExistingEntity_AssignsConceptAppearedInIssueProperties() { // Arrange var mapper = new ConceptAppearedInIssueMapper(); var model = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForConceptAppearedInIssueModel(); // Act IConceptAppearedInIssue existingEntity = new ConceptAppearedInIssue { Id = 1 }; mapper.MapToEntity(model.Object, ref existingEntity); // Assert // <None> // Related Objects Assert.Equal(model.Object.ConceptId, existingEntity.ConceptId); Assert.Equal(model.Object.AppearedInIssueId, existingEntity.AppearedInIssueId); // Associated Objects // <None> }