public void RunWithXsltArguments()
        {
            var working    = Path.Combine(Path.GetTempPath(), "working");
            var artefact   = Path.Combine(Path.GetTempPath(), "artefact");
            var label      = "1.2.3.4";
            var source     = Path.Combine(working, "source.xml");
            var stylesheet = Path.Combine(working, "stylesheet.xsl");
            var output     = Path.Combine(working, "output.xml");

            // Mock the file system
            var fileSystem = mocks.Create <IFileSystem>(MockBehavior.Strict).Object;

            Mock.Get(fileSystem).Setup(_fileSystem => _fileSystem.OpenInputStream(source)).Returns(new MemoryStream()).Verifiable();
            Mock.Get(fileSystem).Setup(_fileSystem => _fileSystem.OpenOutputStream(output)).Returns(new MemoryStream()).Verifiable();

            // Mock the transformer
            var transformer = mocks.Create <ITransformer>(MockBehavior.Strict).Object;

            Mock.Get(transformer).Setup(_transformer => _transformer.Transform(It.Is <string>(s => s == ""), It.Is <string>(s => s == stylesheet), It.Is <Hashtable>(t => t.Count == 1 && (string)t["Test"] == "SomeValue"))).
            Returns("").Verifiable();

            // Initialise the task
            var task = new XslTransformationTask(transformer, fileSystem)
            {
                XMLFile    = source,
                XSLFile    = stylesheet,
                OutputFile = output,
                XsltArgs   = new NameValuePair[1] {
                    new NameValuePair()
                    {
                        Name = "Test", Value = "SomeValue"
                    }
                }
            };

            // Mock the result
            var result = mocks.Create <IIntegrationResult>(MockBehavior.Strict).Object;

            Mock.Get(result).SetupProperty(_result => _result.Status);
            Mock.Get(result).SetupSet(_result => _result.Status = It.IsAny <IntegrationStatus>()).Verifiable();

            var buildProgress = mocks.Create <BuildProgressInformation>(MockBehavior.Strict, artefact, "Project1").Object;

            Mock.Get(result).SetupGet(_result => _result.BuildProgressInformation)
            .Returns(buildProgress);
            Mock.Get(result).SetupGet(_result => _result.WorkingDirectory).Returns(working);
            Mock.Get(result).SetupGet(_result => _result.ArtifactDirectory).Returns(artefact);
            Mock.Get(result).SetupGet(_result => _result.Label).Returns(label);
            Mock.Get(buildProgress).Setup(_buildProgress => _buildProgress.SignalStartRunTask("Transforming")).Verifiable();

            // Run the test
            result.Status = IntegrationStatus.Unknown;
            task.Run(result);

            // Check the results
            mocks.Verify();
        }
        public void Run()
        {
            var working    = Path.Combine(Path.GetTempPath(), "working");
            var artefact   = Path.Combine(Path.GetTempPath(), "artefact");
            var label      = "1.2.3.4";
            var source     = Path.Combine(working, "source.xml");
            var stylesheet = Path.Combine(working, "stylesheet.xsl");
            var output     = Path.Combine(working, "output.xml");

            // Mock the file system
            var fileSystem = mocks.StrictMock <IFileSystem>();

            Expect.Call(fileSystem.OpenInputStream(source)).Return(new MemoryStream());
            Expect.Call(fileSystem.OpenOutputStream(output)).Return(new MemoryStream());

            // Mock the transformer
            var transformer = mocks.StrictMock <ITransformer>();

            Expect.Call(transformer.Transform(null, null, null)).
            IgnoreArguments().Constraints(
                Rhino.Mocks.Constraints.Is.Equal(""),
                Rhino.Mocks.Constraints.Is.Equal(stylesheet),
                Rhino.Mocks.Constraints.Is.TypeOf(typeof(Hashtable)) &&
                Rhino.Mocks.Constraints.List.Count(Rhino.Mocks.Constraints.Is.Equal(0))).
            Return("");

            // Initialise the task
            var task = new XslTransformationTask(transformer, fileSystem)
            {
                XMLFile    = source,
                XSLFile    = stylesheet,
                OutputFile = output
            };

            // Mock the result
            var result = mocks.StrictMock <IIntegrationResult>();

            Expect.Call(result.Status).PropertyBehavior();

            var buildProgress = mocks.StrictMock <BuildProgressInformation>(artefact, "Project1");

            SetupResult.For(result.BuildProgressInformation)
            .Return(buildProgress);
            SetupResult.For(result.WorkingDirectory).Return(working);
            SetupResult.For(result.ArtifactDirectory).Return(artefact);
            SetupResult.For(result.Label).Return(label);
            Expect.Call(() => { buildProgress.SignalStartRunTask("Transforming"); });

            // Run the test
            mocks.ReplayAll();
            result.Status = IntegrationStatus.Unknown;
            task.Run(result);

            // Check the results
            mocks.VerifyAll();
        }