public void ReactivateCascadeRuns()
        {
            BuildProject project = Instance.Create.BuildProject("My Project", "Project");

            IList <AssetID> ids = new List <AssetID>();

            ids.Add(project.ID);
            ids.Add(project.CreateBuildRun("Run 1", new DateTime(2008, 1, 1)).ID);
            ids.Add(project.CreateBuildRun("Run 2", new DateTime(2008, 1, 2)).ID);
            ids.Add(project.CreateBuildRun("Run 3", new DateTime(2008, 1, 3)).ID);

            project.Close();

            foreach (AssetID id in ids)
            {
                Assert.IsTrue(Instance.Get.BaseAssetByID(id).IsClosed);
            }

            project.Reactivate();

            foreach (AssetID id in ids)
            {
                Assert.IsTrue(Instance.Get.BaseAssetByID(id).IsActive);
            }
        }
        public void GetBuildRuns()
        {
            BuildProject project = Instance.Create.BuildProject("My Project", "Project");

            BuildRun run1 = project.CreateBuildRun("Run 1", new DateTime(2008, 1, 1));
            BuildRun run2 = project.CreateBuildRun("Run 2", new DateTime(2008, 1, 2));
            BuildRun run3 = project.CreateBuildRun("Run 3", new DateTime(2008, 1, 3));

            run1.Reference = "A";
            run2.Reference = "A";
            run3.Reference = "B";

            run1.Status.CurrentValue = "Passed";
            run2.Status.CurrentValue = "Passed";
            run3.Status.CurrentValue = "Failed";

            run1.Save();
            run2.Save();
            run3.Save();

            BuildRunFilter filter = new BuildRunFilter();

            filter.References.Add("A");
            filter.Status.Add("Passed");
            ICollection <BuildRun> runs = project.GetBuildRuns(filter);

            CollectionAssert.AreEquivalent(new string[] { "Run 1", "Run 2" }, DeriveListOfNamesFromAssets(runs));
        }
        [Test] public void GetBuildRuns()
        {
            ChangeSet    changeSet      = Instance.Create.ChangeSet(_name, _reference);
            ChangeSet    notMyChangeSet = Instance.Create.ChangeSet("Other ChangeSet", "abcd");
            BuildProject buildProject   = Instance.Create.BuildProject("BP", "1234");
            BuildRun     buildRun       = buildProject.CreateBuildRun("BR", DateTime.Now);
            BuildRun     notMyBuildRun  = buildProject.CreateBuildRun("Not My BR", DateTime.Now);

            buildRun.ChangeSets.Add(changeSet);
            notMyBuildRun.ChangeSets.Add(notMyChangeSet);
            AssetID changeSetId = changeSet.ID;
            AssetID buildRunId  = buildRun.ID;

            ResetInstance();

            changeSet = Instance.Get.ChangeSetByID(changeSetId);
            ICollection <BuildRun> buildRuns = changeSet.GetBuildRuns(null);

            Assert.AreEqual(1, buildRuns.Count);

            IEnumerator <BuildRun> enumerator = buildRuns.GetEnumerator();

            enumerator.MoveNext();
            Assert.AreEqual(buildRunId, enumerator.Current.ID);
        }
        [Test] public void DeleteCascadeRuns()
        {
            BuildProject project = Instance.Create.BuildProject("My Project", "Project");

            IList <AssetID> ids = new List <AssetID>();

            ids.Add(project.ID);
            ids.Add(project.CreateBuildRun("Run 1", new DateTime(2008, 1, 1)).ID);
            ids.Add(project.CreateBuildRun("Run 2", new DateTime(2008, 1, 2)).ID);
            ids.Add(project.CreateBuildRun("Run 3", new DateTime(2008, 1, 3)).ID);

            project.Delete();

            ResetInstance();

            foreach (AssetID id in ids)
            {
                Assert.IsNull(Instance.Get.BaseAssetByID(id));
            }
        }