public TestPlanWebApi.TestPlan CreateTestPlan()
        {
            string projectName = ClientSampleHelpers.FindAnyProject(this.Context).Name;

            // Get a testplan client instance
            VssConnection      connection     = Context.Connection;
            TestPlanHttpClient testPlanClient = connection.GetClient <TestPlanHttpClient>();

            BuildDefinitionReference buildDefinition     = this._getBuildReference();
            TestOutcomeSettings      testOutcomeSettings = new TestOutcomeSettings()
            {
                SyncOutcomeAcrossSuites = true
            };
            ReleaseEnvironmentDefinitionReference releaseEnvironmentDefinition = this._getReleaseEnvironmentDefinitionReference();

            TestPlanWebApi.TestPlanCreateParams testPlanCreateParams = new TestPlanWebApi.TestPlanCreateParams()
            {
                Name            = "newCreatedPlan2",
                AreaPath        = this._getArea(),
                Iteration       = this._getIteration(),
                Description     = "description of the test plan",
                StartDate       = DateTime.Now.AddDays(2),
                EndDate         = DateTime.Now.AddDays(9),
                State           = "Inactive",
                BuildId         = this._getBuildId(),
                BuildDefinition = buildDefinition,
                ReleaseEnvironmentDefinition = releaseEnvironmentDefinition,
                TestOutcomeSettings          = testOutcomeSettings
            };


            // create a test plan
            TestPlanWebApi.TestPlan plan = testPlanClient.CreateTestPlanAsync(testPlanCreateParams, projectName).Result;


            Context.SetValue <TestPlanWebApi.TestPlan>("$newPlan2", plan);
            Context.Log("{0} {1}", plan.Id, plan.Name);
            return(plan);
        }
        public TestPlanWebApi.TestPlan CreateTestPlanWithAreaPathAndIteration()
        {
            string projectName = ClientSampleHelpers.FindAnyProject(this.Context).Name;

            // Get a testplan client instance
            VssConnection      connection     = Context.Connection;
            TestPlanHttpClient testPlanClient = connection.GetClient <TestPlanHttpClient>();

            TestPlanWebApi.TestPlanCreateParams testPlanCreateParams = new TestPlanWebApi.TestPlanCreateParams()
            {
                Name      = "newCreatedPlan1",
                AreaPath  = this._getArea(),
                Iteration = this._getIteration()
            };


            // create a test plan
            TestPlanWebApi.TestPlan plan = testPlanClient.CreateTestPlanAsync(testPlanCreateParams, projectName).Result;


            Context.SetValue <TestPlanWebApi.TestPlan>("$newPlan1", plan);
            Context.Log("{0} {1}", plan.Id, plan.Name);
            return(plan);
        }