public void Can_set_a_default_script()
        {
            // arrange
            var script = "default.py";

            // act
            var actual = DslScriptService.GetScriptName("no used", script);

            // assert
            Assert.AreEqual(script, actual);
        }
        public void Uses_eventname_if_no_default_script()
        {
            // arrange
            var eventName = DslScriptService.EventTypes.BuildEvent;

            // act
            var actual = DslScriptService.GetScriptName(eventName.ToString(), "");

            // assert
            Assert.AreEqual(eventName + ".py", actual);
        }
        public void Can_run_a_script_using_checkin_data()
        {
            // arrange
            var alertMessage  = TestData.DummyCheckInAlertXml();
            var emailProvider = new Moq.Mock <IEmailProvider>();
            var tfsProvider   = new Moq.Mock <ITfsProvider>();
            var sut           = new DslScriptService(emailProvider.Object, tfsProvider.Object, @"dsl\tfs\fullscript.py", @".\dsl");

            // redirect the console
            var consoleOut = Helpers.Logging.RedirectConsoleOut();

            // act
            sut.Notify(alertMessage, string.Empty);

            // assert
            Assert.AreEqual("A checkin event 62" + Environment.NewLine, consoleOut.ToString());
        }
        public void Can_run_a_script_using_build_data()
        {
            // arrange
            var alertMessage  = TestData.DummyBuildStatusChangedAlertXmlWithQualityChange();
            var emailProvider = new Moq.Mock <IEmailProvider>();
            var tfsProvider   = new Moq.Mock <ITfsProvider>();
            var sut           = new DslScriptService(emailProvider.Object, tfsProvider.Object, @"dsl\tfs\fullscript.py", @".\dsl");

            // redirect the console
            var consoleOut = Helpers.Logging.RedirectConsoleOut();

            // act
            sut.Notify(alertMessage, string.Empty);

            // assert
            Assert.AreEqual("A build event vstfs:///Build/Build/49" + Environment.NewLine, consoleOut.ToString());
        }