public void Can_use_Dsl_to_update_a_work_item()
        {
            // arrange
            // redirect the console
            var consoleOut = Helpers.Logging.RedirectConsoleOut();

            var emailProvider       = new Moq.Mock <IEmailProvider>();
            var azureDevOpsProvider = new Moq.Mock <IAzureDevOpsProvider>();
            var eventDataProvider   = new Moq.Mock <IEventDataProvider>();

            azureDevOpsProvider.Setup(t => t.CreateWorkItem(
                                          "tp",
                                          "Bug",
                                          new Dictionary <string, object>()
            {
                { "Title", "The Title" },
                { "Estimate", 2 }
            })).Returns(RestTestData.CreateWorkItem());
            var engine = new AzureDevOpsEventsProcessor.Dsl.DslProcessor();

            // act
            engine.RunScript(
                @"TestDataFiles\Scripts\AzureDevOps\api\updatewi.py",
                azureDevOpsProvider.Object,
                emailProvider.Object,
                eventDataProvider.Object);

            // assert
            azureDevOpsProvider.Verify(t => t.UpdateWorkItem(It.IsAny <JObject>()));
        }
        public void Can_use_Dsl_to_create_a_work_item()
        {
            // arrange
            // redirect the console
            var consoleOut = Helpers.Logging.RedirectConsoleOut();

            var emailProvider       = new Moq.Mock <IEmailProvider>();
            var azureDevOpsProvider = new Moq.Mock <IAzureDevOpsProvider>();
            var eventDataProvider   = new Moq.Mock <IEventDataProvider>();

            azureDevOpsProvider.Setup(t => t.CreateWorkItem(
                                          It.IsAny <string>(),
                                          It.IsAny <string>(),
                                          It.IsAny <Dictionary <string, object> >())).Returns(RestTestData.CreateWorkItem());
            var engine = new AzureDevOpsEventsProcessor.Dsl.DslProcessor();

            // act
            engine.RunScript(
                @"TestDataFiles\Scripts\AzureDevOps\api\createwi.py",
                azureDevOpsProvider.Object,
                emailProvider.Object,
                eventDataProvider.Object);

            // assert
            azureDevOpsProvider.Verify(t => t.CreateWorkItem(
                                           "SampleProject",
                                           "Bug",
                                           new Dictionary <string, object>()
            {
                { "System.Title", "The Title" },
                { "Microsoft.VSTS.Scheduling.Effort", 2 }
            }));

            Assert.AreEqual(
                "Work item '299' has been created with the title 'JavaScript implementation for Microsoft Account'" + Environment.NewLine,
                consoleOut.ToString());
        }