public void TestGetProjectWhereParentAndGrandchildAreInverted()
 {
     // Given a connection to an instance of VersionOne at https://www14.v1host.com/v1sdktesting/ with user credentials for admin
     var instance = new V1Instance("https://www14.v1host.com/v1sdktesting/", "admin", "admin");
     // And a new schedule with 7 day length and no gap
     var schedule = instance.Create.Schedule(Name("Schedule"), Duration.Parse(@"7 Days"), Duration.Parse(@"0 Days"));
     // And a new parent project under the root with that schedule
     var rootProject = instance.Get.ProjectByID(AssetID.FromToken("Scope:0"));
     var parentProject = instance.Create.Project(Name("Parent Project"), rootProject, DateTime.Now, schedule);
     // And a new child project under the parent with the same schedule
     var childProject = instance.Create.Project(Name("Child Project"), parentProject, DateTime.Now, schedule);
     // And a new grandchild project under the root
     var grandChildProject = instance.Create.Project(Name("Grandchild Project"), rootProject, DateTime.Now, schedule);
     // And move the Parent into the Grandchild
     parentProject.ParentProject = grandChildProject;
     parentProject.Save();
     // And a new helper
     var v1System = new SystemAllProjects(instance.ApiClient.Services, instance.ApiClient.MetaModel);
     // And the list of all projects
     var projectList = v1System.GetProjects();
     // When I ask for the project path for the child project
     var actual = projectList[childProject.ID.Token].PathName;
     // Then I get a concatenation of the root project, the parent project, and the child project, in that order
     var expected = rootProject.Name + "\\" + grandChildProject.Name + "\\" + parentProject.Name + "\\" + childProject.Name;
     Assert.AreEqual(expected, actual);
 }
 public void TestHasChangedSinceWithAChange()
 {
     // Given a connection to an instance of VersionOne at https://www14.v1host.com/v1sdktesting/ with user credentials for admin
     var instance = new V1Instance("https://www14.v1host.com/v1sdktesting/", "admin", "admin");
     // And a new schedule with 7 day length and no gap
     var schedule = instance.Create.Schedule(Name("Schedule"), Duration.Parse(@"7 Days"), Duration.Parse(@"0 Days"));
     // And a new parent project called "Target Project 1" under the root with that schedule
     var rootProject = instance.Get.ProjectByID(AssetID.FromToken("Scope:0"));
     var targetProject = instance.Create.Project(Name("Target Project"), rootProject, DateTime.Now, schedule);
     // And a defect under "Target Project"
     var newDefect = instance.Create.Defect(Name("New Defect"), targetProject);
     // And a new project helper
     var v1System = new SystemAllProjects(instance.ApiClient.Services, instance.ApiClient.MetaModel);
     // And the list of all projects
     var projectList = v1System.GetProjects();
     // And a new defect monitor
     var monitor = new DefectMonitor(instance.ApiClient.Services, instance.ApiClient.MetaModel);
     // And the parent project is registered with the monitor
     monitor.MonitoredProjects.Add(projectList[targetProject.ID.Token]);
     // And the most recent change date is for the defect
     var lastChange = monitor.GetMostRecentChangeDateTime();
     // When I create a new defect
     var newerDefect = instance.Create.Defect(Name("Newer Defect"), targetProject);
     // And check whether the system has changed since the remembered change date
     var actual = monitor.HasChangedSince(lastChange);
     // Then the monitor tells me there is a change
     Assert.IsTrue(actual);
 }
 public void TestConstructionOfProjectList()
 {
     // Given a connection to an instance of VersionOne at https://www14.v1host.com/v1sdktesting/ with user credentials for admin
     var instance = new V1Instance("https://www14.v1host.com/v1sdktesting/", "admin", "admin");
     // And a new schedule with 7 day length and no gap
     var schedule = instance.Create.Schedule(Name("Schedule"), Duration.Parse(@"7 Days"), Duration.Parse(@"0 Days"));
     // And a new parent project called "Target Project 1" under the root with that schedule
     var rootProject = instance.Get.ProjectByID(AssetID.FromToken("Scope:0"));
     var target1Project = instance.Create.Project(Name("Target Project 1"), rootProject, DateTime.Now, schedule);
     // And a new child project under "Target Project 1" with the same schedule
     var targetChildProject = instance.Create.Project(Name("Child Target Project"), target1Project, DateTime.Now, schedule);
     // And another project under the root called "Target Project 2"
     var target2Project = instance.Create.Project(Name("Target Project 2"), rootProject, DateTime.Now, schedule);
     // And a new child project under "Target Project 2" with the same schedule called "Child Non-target Project"
     var nontargetChildProject = instance.Create.Project(Name("Child Non-target Project"), target2Project, DateTime.Now, schedule);
     // And a new helper
     var v1System = new SystemAllProjects(instance.ApiClient.Services, instance.ApiClient.MetaModel);
     // And the list of all projects
     var projectList = v1System.GetProjects();
     // When I ask for the list of projects for "Target Project 1" with descendants and "Target Project 2" without descendants
     var myProjectList = new List<Project>();
     myProjectList.AddRange(projectList[target1Project.ID.Token].ChildrenMeAndDown);
     myProjectList.AddRange(projectList[target2Project.ID.Token].JustMe);
     // Then I don't get "Child Non-target Project" in the results.
     Assert.IsFalse(myProjectList.Contains(projectList[nontargetChildProject.ID.Token]));
 }
 public void TestChildrenMeAndDown()
 {
     // Given a connection to an instance of VersionOne at https://www14.v1host.com/v1sdktesting/ with user credentials for admin
     var instance = new V1Instance("https://www14.v1host.com/v1sdktesting/", "admin", "admin");
     // And a new schedule with 7 day length and no gap
     var schedule = instance.Create.Schedule(Name("Schedule"), Duration.Parse(@"7 Days"), Duration.Parse(@"0 Days"));
     // And a new parent project under the root with that schedule
     var rootProject = instance.Get.ProjectByID(AssetID.FromToken("Scope:0"));
     var parentProject = instance.Create.Project(Name("Parent Project"), rootProject, DateTime.Now, schedule);
     // And a new child project under the parent with the same schedule
     var child3Project = instance.Create.Project(Name("Child Project"), parentProject, DateTime.Now, schedule);
     // And a new subchild project
     var child4Project = instance.Create.Project(Name("Child Project"), child3Project, DateTime.Now, schedule);
     // And a new subchild project
     var child5Project = instance.Create.Project(Name("Child Project"), child4Project, DateTime.Now, schedule);
     // And a new subchild project
     var child6Project = instance.Create.Project(Name("Child Project"), child5Project, DateTime.Now, schedule);
     // And a new helper
     var v1System = new SystemAllProjects(instance.ApiClient.Services, instance.ApiClient.MetaModel);
     // And the list of all projects
     var projectList = v1System.GetProjects();
     // When I ask for the count of children, me, and down from the parent project
     var actual = projectList[parentProject.ID.Token].ChildrenMeAndDown.Count;
     // Then I get 5.
     var expected = 5;
     Assert.AreEqual(expected, actual);
 }
 public void TestMoveIsDirty()
 {
     // Given a connection to an instance of VersionOne at https://www14.v1host.com/v1sdktesting/ with user credentials for admin
     var instance = new V1Instance("https://www14.v1host.com/v1sdktesting/", "admin", "admin");
     // And a new schedule with 7 day length and no gap
     var schedule = instance.Create.Schedule(Name("Schedule"), Duration.Parse(@"7 Days"), Duration.Parse(@"0 Days"));
     // And a new parent project under the root with that schedule
     var rootProject = instance.Get.ProjectByID(AssetID.FromToken("Scope:0"));
     var parentProject = instance.Create.Project(Name("Parent Project"), rootProject, DateTime.Now, schedule);
     // And a new child project under the parent with the same schedule
     var childProject = instance.Create.Project(Name("Child Project"), parentProject, DateTime.Now, schedule);
     // And a new helper
     var helper = new SystemAllProjects(instance.ApiClient.Services, instance.ApiClient.MetaModel);
     // And the helper is clean after a reload
     helper.Reload();
     // When I move the child project
     childProject.ParentProject = rootProject;
     childProject.Save();
     // Then the helper is dirty
     Assert.IsTrue(helper.IsDirty());
 }
 public void TestReloadIsClean()
 {
     // Given a connection to an instance of VersionOne at https://www14.v1host.com/v1sdktesting/ with user credentials for admin
     var instance = new V1Instance("https://www14.v1host.com/v1sdktesting/", "admin", "admin");
     // When I create a new Helper
     var helper = new SystemAllProjects(instance.ApiClient.Services, instance.ApiClient.MetaModel);
     // And reload the project data
     helper.Reload();
     // Then the helper is not dirty
     Assert.IsFalse(helper.IsDirty());
 }
 public void TestNewHelperIsDirty()
 {
     // Given a connection to an instance of VersionOne at https://www14.v1host.com/v1sdktesting/ with user credentials for admin
     var instance = new V1Instance("https://www14.v1host.com/v1sdktesting/", "admin", "admin");
     // When I create a new Helper
     var helper = new SystemAllProjects(instance.ApiClient.Services, instance.ApiClient.MetaModel);
     // Then it is initially dirty
     Assert.IsTrue(helper.IsDirty());
 }