コード例 #1
0
        public void WhenMinimumOSPlatformIsHigherThanTargetPlatformVersionItShouldError()
        {
            TestProject testProject = SetUpProject();

            var targetPlatformIdentifier = "iOS";

            testProject.AdditionalProperties["TargetPlatformIdentifier"] = targetPlatformIdentifier;
            testProject.AdditionalProperties["TargetPlatformVersion"]    = "13.2";
            testProject.AdditionalProperties["MinimumOSPlatform"]        = "14.0";

            var testAsset = _testAssetsManager.CreateTestProject(testProject);

            var buildCommand = new DotnetBuildCommand(Log, Path.Combine(testAsset.Path, "Project", "Project.csproj"));

            buildCommand.Execute()
            .Should()
            .Fail().And.HaveStdOutContaining("NETSDK1135");
        }
コード例 #2
0
        public void ItBuildsARunnableOutput()
        {
            var testAppName  = "MSBuildTestApp";
            var testInstance = _testAssetsManager.CopyTestAsset(testAppName)
                               .WithSource();

            var buildCommand = new DotnetBuildCommand(Log, testInstance.Path);

            buildCommand
            .Execute()
            .Should().Pass();

            var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";

            var outputDll = Path.Combine(testInstance.Path, "bin", configuration, "netcoreapp3.1", $"{testAppName}.dll");

            var outputRunCommand = new DotnetCommand(Log);

            outputRunCommand.Execute(outputDll)
            .Should().Pass()
            .And.HaveStdOutContaining("Hello World");
        }