Пример #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)));
        }
Пример #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")));
        }
Пример #3
0
        public Action ConfigureAction(Action <MsBuildActionConfigurator> configure)
        {
            var msBuildProperties  = new MsBuildProperties();
            var actionConfigurator = new MsBuildActionConfigurator(msBuildProperties);

            configure(actionConfigurator);

            return(() => _msBuildRunner.Run(msBuildProperties));
        }
Пример #4
0
        public void Run(MsBuildProperties msBuildProperties)
        {
            var processProperties = new ProcessProperties()
                {
                    Executable = "MSBuild.exe",
                    Arguments = BuildArguments(msBuildProperties)
                };

            _processRunner.RunProcess(processProperties);
        }
Пример #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)));
        }
Пример #6
0
        public void Run(MsBuildProperties msBuildProperties)
        {
            var processProperties = new ProcessProperties()
            {
                Executable = "MSBuild.exe",
                Arguments  = BuildArguments(msBuildProperties)
            };

            _processRunner.RunProcess(processProperties);
        }
Пример #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")));
        }
Пример #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();
        }
Пример #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());
        }