示例#1
0
 public VSTSWorkItemsRepository(IOptions <VSTSApiSettings> settings, HttpClient httpClient)
 {
     mSettings = settings.Value;
     mClient   = new VSTSClient(mSettings, httpClient);
 }
示例#2
0
        static void Main(string[] args)
        {
            // Need to add better management for the args
            Console.WriteLine("###################################################");
            Console.WriteLine("------> Enter your Login (Basic Authentification must be activated) :");
            lusername = Console.ReadLine();
            Console.WriteLine("------> Password :"******"------> VSTS Tenant (https://XXXXXXXXXX.visualstudio.com) :");
            laccount = Console.ReadLine();
            Console.WriteLine("###################################################");
            Console.WriteLine("------> Project name :");
            newProjectName = Console.ReadLine();
            newTeamName    = newProjectName + "%20Team";
            Console.WriteLine("###################################################");
            Console.WriteLine("### Initiating connexion :");
            Console.WriteLine("### Get Template ID :");

            Console.WriteLine("### Create new demo projet :");

            try
            {
                using (var client = new VSTSClient(lusername, lpassword, laccount, newProjectName))
                {
                    var projects = client.GetTenantProjects().Result;
                    foreach (var project in projects)
                    {
                        Console.WriteLine(project);
                    }
                    client.CreateProject(newProjectName, "Agile")
                    .ContinueWith(_ => {
                        client.ConfigureBoard().Wait();

                        Thread.Sleep(5000);
                        Console.WriteLine("------> Do you want to assign the tasks to someone ? Y/N");
                        string assignatedYorN = Console.ReadLine();
                        string assignedTO     = null;
                        if (assignatedYorN.ToUpper() == "Y")
                        {
                            Console.WriteLine("### Assign Tasks to :\n Use the correct type like this \"First Name <*****@*****.**>\"\n Example : Julien Stroheker <*****@*****.**>");
                            assignedTO = Console.ReadLine();
                        }
                        client.CreateUserStory("Welcome Guests", "Closed", "Logistics", "User Story", assignedTO);
                        Thread.Sleep(1000);
                        client.CreateUserStory("Demonstrate Kanban", "Active", "Demonstrations", "User Story", assignedTO);
                        Thread.Sleep(1000);
                        client.CreateUserStory("Explain how the Hackathon will work ?", "Active", "Presentation", "User Story", assignedTO);
                        Thread.Sleep(1000);
                        client.CreateUserStory("DevOps Overview", "Active", "Presentation", "User Story", assignedTO);
                        Thread.Sleep(1000);
                        client.CreateUserStory("Demonstrate APM + Automated Recovery Parts Unlimited App", "New", "Demonstrations", "User Story", assignedTO);
                        Thread.Sleep(1000);

                        client.CreateUserStory("Demonstrate Cloud Based Load Testing + Autoscale policies in IaC", "New", "Demonstrations", "User Story", assignedTO);
                        Thread.Sleep(1000);
                        client.CreateUserStory("Demonstrate Infrastructure as Code with Azure Resource Manager Deployment Templates", "New", "Demonstrations", "User Story", assignedTO);
                        Thread.Sleep(1000);
                        client.CreateUserStory("Demonstrate Continuous Deployment and Release Management with Visual Studio Team Services", "New", "Demonstrations", "User Story", assignedTO);
                        Thread.Sleep(1000);
                        client.CreateUserStory("Demonstrate Continuous Integration with Visual Studio Team Services", "New", "Demonstrations", "User Story", assignedTO);
                        Thread.Sleep(1000);

                        client.CreateUserStory("Let’s form our teams!", "New", "Let's Hack", "User Story", assignedTO);
                        Thread.Sleep(1000);
                        client.CreateUserStory("Activate your Tools", "New", "Let's Hack", "User Story", assignedTO);
                        Thread.Sleep(1000);
                        Thread.Sleep(5000);
                        client.PushStyleConf();
                        Console.WriteLine("###################################################");


                        //BuildConf();
                        //test();
                        Console.WriteLine("END");
                        Console.WriteLine("###################################################");
                        Console.WriteLine("Type any key to close this window...");
                        Console.ReadKey();
                    }).Wait();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }