public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock<IDbSet<IssueAlias>> mockSetIssueAliases; var mockContext = IssueAliasesMockingSetup.DoMockingSetupForContext(false, out mockSetIssueAliases); var repository = new IssueAliasesRepository(mockContext.Object); var issueAliases = new IssueAlias { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(issueAliases); // Assert mockSetIssueAliases.Verify(x => x.Add(issueAliases), Times.Once); }
public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock <IDbSet <IssueAlias> > mockSetIssueAliases; var mockContext = IssueAliasesMockingSetup.DoMockingSetupForContext(false, out mockSetIssueAliases); var repository = new IssueAliasesRepository(mockContext.Object); var issueAliases = new IssueAlias { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(issueAliases); // Assert mockSetIssueAliases.Verify(x => x.Add(issueAliases), Times.Once); }
public void Verify_MapToEntity_WithExistingEntity_AssignsIssueAliasProperties() { // Arrange var mapper = new IssueAliasMapper(); var model = IssueAliasesMockingSetup.DoMockingSetupForIssueAliasModel(); // Act IIssueAlias existingEntity = new IssueAlias { Id = 1 }; mapper.MapToEntity(model.Object, ref existingEntity); // Assert // <None> // Related Objects Assert.Equal(model.Object.IssueId, existingEntity.IssueId); // Associated Objects // <None> }