public void ProjectPropertyChanged_WhenParentIdOfAProjectChanges_RepositoryAddChangedProjectToCorrectParentsChildList() { var parentProjectRef = new projectref { href = "projectParentHref" }; var childProjectRef = new projectref { href = "projectChildHref" }; var projectRefList = new List<projectref> { parentProjectRef, childProjectRef }; var projects1Dto = new projects1 { project = projectRefList }; var parentProjectDto = new project { id = "parentProject", parentProject = new projectref (), buildTypes = new List<buildTyperef>()}; var childProjectDto = new project { id = "childProject", parentProject = new projectref { id = "parentProject" }, buildTypes = new List<buildTyperef>()}; this.testee.SetData(projects1Dto); var parentProject = this.testee.Projects.First(project => project.Url == parentProjectRef.href); var childProject = this.testee.Projects.First(project => project.Url == childProjectRef.href); parentProject.SetData(parentProjectDto); childProject.SetData(childProjectDto); this.testee.Projects.First(project => project.Url == parentProject.Url).ChildProjects.Should().Contain(childProject); }
public void SetUp() { this.testee = new Project(Url); this.projectDto = new project { id = "projectId", name = "projectName", description = "projectDescprition", parentProject = new projectref { id = "parentProjectId" }, buildTypes = new List<buildTyperef> { new buildTyperef { href = "buildtype1Href" }, new buildTyperef { href = "buildtype2Href" } } }; }
public void ProjectPropertyChanged_WhenParentIdOfAProjectChanges_RepositoryRemovesChangedProjectFromParentsChildList() { var parentProjectRef = new projectref { href = "projectParentHref" }; var secondParentProjectRef = new projectref { href = "secondProjectParentHref" }; var childProjectRef = new projectref { href = "projectChildHref" }; var projectRefList = new List<projectref> { parentProjectRef, secondParentProjectRef, childProjectRef }; var projects1Dto = new projects1 { project = projectRefList }; var parentProjectDto = new project { id = "parentProject", parentProject = new projectref(), buildTypes = new List<buildTyperef>() }; var secondParentProjectDto = new project { id = "secondParentProject", parentProject = new projectref(), buildTypes = new List<buildTyperef>() }; var childProjectDto = new project { id = "childProject", parentProject = new projectref { id = "parentProject" }, buildTypes = new List<buildTyperef>() }; var changedParentchildProjectDto = new project { id = "childProject", parentProject = new projectref { id = "secondParentProject" }, buildTypes = new List<buildTyperef>() }; this.testee.SetData(projects1Dto); var parentProject = this.testee.Projects.First(project => project.Url == parentProjectRef.href); var secondParentProject = this.testee.Projects.First(project => project.Url == secondParentProjectRef.href); var childProject = this.testee.Projects.First(project => project.Url == childProjectRef.href); parentProject.SetData(parentProjectDto); secondParentProject.SetData(secondParentProjectDto); childProject.SetData(childProjectDto); childProject.SetData(changedParentchildProjectDto); this.testee.Projects.First(project => project.Url == parentProject.Url).ChildProjects.Should().BeEmpty(); }