Ejemplo n.º 1
0
        public void AllTargetsArePassedToMsBuildInCorrectFormat()
        {
            var properties = new MsBuildProperties { Targets = new[] { "Clean", "Compile" } };

            _msBuildRunner.Run(properties);

            _processRunner.Received()
                .RunProcess(Arg.Is<ProcessProperties>(pp => new[] { "/target:Clean", "/target:Compile" }.IsSubsetOf(pp.Arguments)));
        }
Ejemplo n.º 2
0
        public void WhenNoLogoSpecifiedTheSwitchIsPassedToMsBuild()
        {
            var properties = new MsBuildProperties { NoLogo = true };

            _msBuildRunner.Run(properties);

            _processRunner.Received()
                .RunProcess(Arg.Is<ProcessProperties>(pp => pp.Arguments.Contains("/nologo")));
        }
Ejemplo n.º 3
0
        public Action ConfigureAction(Action <MsBuildActionConfigurator> configure)
        {
            var msBuildProperties  = new MsBuildProperties();
            var actionConfigurator = new MsBuildActionConfigurator(msBuildProperties);

            configure(actionConfigurator);

            return(() => _msBuildRunner.Run(msBuildProperties));
        }
Ejemplo n.º 4
0
        public void Run(MsBuildProperties msBuildProperties)
        {
            var processProperties = new ProcessProperties()
                {
                    Executable = "MSBuild.exe",
                    Arguments = BuildArguments(msBuildProperties)
                };

            _processRunner.RunProcess(processProperties);
        }
Ejemplo n.º 5
0
        public void AllArbitraryArgumentsArePassedToMsbuildAsIs()
        {
            var arbitraryArguments = new[] { "/arbArg1", "-arbArg2", "/arbArg3:someValue" };
            var properties = new MsBuildProperties { ArbitraryArguments = arbitraryArguments };

            _msBuildRunner.Run(properties);

            _processRunner.Received()
                .RunProcess(Arg.Is<ProcessProperties>(pp => arbitraryArguments.IsSubsetOf(pp.Arguments)));
        }
Ejemplo n.º 6
0
        public void Run(MsBuildProperties msBuildProperties)
        {
            var processProperties = new ProcessProperties()
            {
                Executable = "MSBuild.exe",
                Arguments  = BuildArguments(msBuildProperties)
            };

            _processRunner.RunProcess(processProperties);
        }
Ejemplo n.º 7
0
        public void ProjectNameShoudBeLastArgumentToMsBuild()
        {
            var properties = new MsBuildProperties
                {
                    Project = "the-project-name.csproj",
                    ArbitraryArguments = new[] { "/arbArgument1", "/argArgument2" }
                };

            _msBuildRunner.Run(properties);

            _processRunner.Received()
                .RunProcess(Arg.Is<ProcessProperties>(pp => pp.Arguments.Last().Equals("the-project-name.csproj")));
        }
Ejemplo n.º 8
0
        private static string[] BuildArguments(MsBuildProperties msBuildProperties)
        {
            var args = new List<string>();

            args.AddRange(msBuildProperties.ArbitraryArguments);

            if (msBuildProperties.NoLogo)
                args.Add("/nologo");

            args.AddRange(
                msBuildProperties.Targets.Select(target => "/target:" + target));

            args.Add(msBuildProperties.Project);
            return args.ToArray();
        }
Ejemplo n.º 9
0
        private static string[] BuildArguments(MsBuildProperties msBuildProperties)
        {
            var args = new List <string>();

            args.AddRange(msBuildProperties.ArbitraryArguments);

            if (msBuildProperties.NoLogo)
            {
                args.Add("/nologo");
            }

            args.AddRange(
                msBuildProperties.Targets.Select(target => "/target:" + target));

            args.Add(msBuildProperties.Project);
            return(args.ToArray());
        }