예제 #1
0
        public static AndConstraint <CommandResultAssertions> DidNotFindCompatibleFrameworkVersion(this CommandResultAssertions assertion, string frameworkName, string requestedVersion)
        {
            var constraint = assertion.HaveStdErrContaining("You must install or update .NET to run this application.");

            if (frameworkName is not null)
            {
                constraint = constraint.And.HaveStdErrContaining($"Framework: '{frameworkName}', {(requestedVersion is null ? "" : $"version '{requestedVersion}'")}");
            }
        public static AndConstraint <CommandResultAssertions> FindAnySdk(this CommandResultAssertions assertion, bool shouldFindAnySdk)
        {
            string noSdkMessage = "No .NET SDKs were found";

            return(shouldFindAnySdk
                ? assertion.NotHaveStdErrContaining(noSdkMessage)
                : assertion.HaveStdErrContaining(noSdkMessage)
                   .And.HaveStdErrContaining("Download a .NET SDK:"));
        }
        public static AndConstraint <CommandResultAssertions> HaveUsedDotNetRootInstallLocation(this CommandResultAssertions assertion,
                                                                                                string installLocation,
                                                                                                string rid,
                                                                                                string arch)
        {
            // If no arch is passed and we are on Windows, we need the used RID for determining whether or not we are running on WoW64.
            if (string.IsNullOrEmpty(arch))
            {
                Assert.NotNull(rid);
            }

            string expectedEnvironmentVariable = !string.IsNullOrEmpty(arch) ? $"DOTNET_ROOT_{arch.ToUpper()}" :
                                                 IsRunningInWoW64(rid) ? "DOTNET_ROOT(x86)" : "DOTNET_ROOT";

            return(assertion.HaveStdErrContaining($"Using environment variable {expectedEnvironmentVariable}=[{installLocation}] as runtime location."));
        }
        public static AndConstraint <CommandResultAssertions> NotFindCompatibleSdk(this CommandResultAssertions assertion, string globalJsonPath = null, string requestedVersion = null)
        {
            var constraint = assertion.HaveStdErrContaining("compatible .NET SDK was not found");

            if (globalJsonPath is not null)
            {
                constraint = constraint.And.HaveStdErrContaining($"global.json file: {globalJsonPath}");
            }

            if (requestedVersion is not null)
            {
                constraint = constraint.And.HaveStdErrContaining($"Requested SDK version: {requestedVersion}");
            }

            if (globalJsonPath is not null && requestedVersion is not null)
            {
                constraint = constraint.And.HaveStdErrContaining($"Install the [{requestedVersion}] .NET SDK or update [{globalJsonPath}] to match an installed SDK.");
            }

            return(constraint);
        }
 public static AndConstraint <CommandResultAssertions> HaveUsedGlobalInstallLocation(this CommandResultAssertions assertion, string installLocation)
 {
     return(assertion.HaveStdErrContaining($"Using global installation location [{installLocation}]"));
 }
 public static AndConstraint <CommandResultAssertions> HaveUsedConfigFileInstallLocation(this CommandResultAssertions assertion, string installLocation)
 {
     return(assertion.HaveStdErrContaining($"Using install location '{installLocation}'."));
 }
예제 #7
0
 public static AndConstraint <CommandResultAssertions> InitializeSecondaryContext(this CommandResultAssertions assertion, string path, int statusCode)
 {
     return(assertion.HaveStdErrContaining($"Initialized secondary context for config: {path}")
            .And.HaveStdOutContaining($"hostfxr_initialize_for_runtime_config succeeded: 0x{statusCode.ToString("x")}"));
 }
예제 #8
0
 public static AndConstraint <CommandResultAssertions> InitializeContextForConfig(this CommandResultAssertions assertion, string path)
 {
     return(assertion.HaveStdErrContaining($"Initialized context for config: {path}"));
 }
예제 #9
0
 public static FluentAssertions.AndConstraint <CommandResultAssertions> ExecuteApplication(this CommandResultAssertions assertion, string hostPath, string appPath)
 {
     return(assertion.HaveStdErrContaining($"Launch host: {hostPath}, app: {appPath}")
            .And.HaveStdOutContaining("Hello World!"));
 }
 public static AndConstraint <CommandResultAssertions> HaveLookedForDefaultInstallLocation(this CommandResultAssertions assertion, string installLocationPath)
 {
     return(assertion.HaveStdErrContaining($"Looking for install_location file in '{Path.Combine(installLocationPath, "install_location")}'."));
 }
 public static AndConstraint <CommandResultAssertions> DidNotRecognizeRollForwardValue(this CommandResultAssertions assertion, string value)
 {
     return(assertion.HaveStdErrContaining($"Unrecognized roll forward setting value '{value}'."));
 }
 public static AndConstraint <CommandResultAssertions> RestartedFrameworkResolution(this CommandResultAssertions assertion, string resolvedVersion, string newVersion)
 {
     return(assertion.HaveStdErrContaining($"--- Restarting all framework resolution because the previously resolved framework 'Microsoft.NETCore.App', version '{resolvedVersion}' must be re-resolved with the new version '{newVersion}'"));
 }
 public static AndConstraint <CommandResultAssertions> HaveLookedForArchitectureSpecificInstallLocation(this CommandResultAssertions assertion, string installLocationPath, string architecture)
 {
     return(assertion.HaveStdErrContaining($"Looking for architecture specific install_location file in '{Path.Combine(installLocationPath, "install_location_" + architecture.ToLowerInvariant())}'."));
 }
 public static AndConstraint <CommandResultAssertions> HaveFoundDefaultInstallLocationInConfigFile(this CommandResultAssertions assertion, string installLocation)
 {
     return(assertion.HaveStdErrContaining($"Found install location path '{installLocation}'."));
 }
 public static AndConstraint <CommandResultAssertions> DidNotFindCompatibleFrameworkVersion(this CommandResultAssertions assertion)
 {
     return(assertion.HaveStdErrContaining("It was not possible to find any compatible framework version"));
 }
 public static AndConstraint <CommandResultAssertions> HaveFoundArchSpecificInstallLocationInConfigFile(this CommandResultAssertions assertion, string installLocation, string arch)
 {
     return(assertion.HaveStdErrContaining($"Found architecture-specific install location path: '{installLocation}' ('{arch}')."));
 }
예제 #17
0
 public static AndConstraint <CommandResultAssertions> HaveUsedRegisteredInstallLocation(this CommandResultAssertions assertion, string installLocation)
 {
     return(assertion.HaveStdErrContaining($"Found registered install location '{installLocation}'."));
 }