Пример #1
0
        public void VerifyErrorWithIllegalChars()
        {
            string toolPath = SdkToolsPathUtility.GeneratePathToTool(_mockExists.MockFileDoesNotExist, ProcessorArchitecture.X86, "./?><;)(*&^%$#@!", _toolName, _log, true);

            Assert.IsNull(toolPath);
            _mockEngine.AssertLogContains("MSB3666");
            Assert.AreEqual(1, _mockEngine.Errors);
        }
Пример #2
0
        public void GeneratePathToToolX86ExistsOnx86()
        {
            string toolPath = SdkToolsPathUtility.GeneratePathToTool(_mockExists.MockFileExistsOnlyInX86, ProcessorArchitecture.X86, _defaultSdkToolsPath, _toolName, _log, true);

            // Path we expect to get out of the method
            string expectedPath = Path.Combine(_defaultSdkToolsPath, _toolName);

            Assert.Equal(expectedPath, toolPath);
            Assert.True(String.IsNullOrEmpty(_mockEngine.Log));
        }
Пример #3
0
        public void GeneratePathToToolX86ExistsOnx86()
        {
            string toolPath = SdkToolsPathUtility.GeneratePathToTool(_mockExists.MockFileExistsOnlyInX86, ProcessorArchitecture.X86, _defaultSdkToolsPath, _toolName, _log, true);

            // Path we expect to get out of the method
            string expectedPath = Path.Combine(_defaultSdkToolsPath, _toolName);

            // Message to show when the test fails.
            string message = "Expected to find the tool in the defaultSdkToolsPath but the method returned:" + toolPath;

            Assert.True(string.Equals(expectedPath, toolPath, StringComparison.OrdinalIgnoreCase), message);
            Assert.True(String.IsNullOrEmpty(_mockEngine.Log));
        }
Пример #4
0
        public void VerifyErrorWithIllegalChars()
        {
            if (!NativeMethodsShared.IsWindows)
            {
                return; // "No invalid path characters under Unix"
            }

            string toolPath = SdkToolsPathUtility.GeneratePathToTool(_mockExists.MockFileDoesNotExist, ProcessorArchitecture.X86, "./?><;)(*&^%$#@!", _toolName, _log, true);

            Assert.Null(toolPath);
            _mockEngine.AssertLogContains("MSB3666");
            Assert.Equal(1, _mockEngine.Errors);
        }
Пример #5
0
        public void GeneratePathToToolX86DoesNotExistAnywhereNoLogging()
        {
            string toolPath = SdkToolsPathUtility.GeneratePathToTool(_mockExists.MockFileDoesNotExist, ProcessorArchitecture.X86, _defaultSdkToolsPath, _toolName, _log, false);

            Assert.Null(toolPath);

            string comment = ResourceUtilities.FormatResourceString("General.PlatformSDKFileNotFoundSdkToolsPath", _toolName, _defaultSdkToolsPath, _defaultSdkToolsPath);

            _mockEngine.AssertLogDoesntContain(comment);

            comment = ResourceUtilities.FormatResourceString("General.SdkToolsPathToolDoesNotExist", _toolName, _defaultSdkToolsPath, ToolLocationHelper.GetDotNetFrameworkSdkRootRegistryKey(TargetDotNetFrameworkVersion.Version45));
            _mockEngine.AssertLogDoesntContain(comment);
            Assert.Equal(0, _mockEngine.Errors);
        }
Пример #6
0
        public void GeneratePathToToolNullOrEmptySdkToolPathNoLogging()
        {
            string toolPath = SdkToolsPathUtility.GeneratePathToTool(_mockExists.MockFileExistsOnlyInX86, ProcessorArchitecture.X86, null, _toolName, _log, false);

            Assert.Null(toolPath);

            string comment = ResourceUtilities.FormatResourceString("General.SdkToolsPathNotSpecifiedOrToolDoesNotExist", _toolName, null);

            _mockEngine.AssertLogDoesntContain(comment);
            Assert.Equal(0, _mockEngine.Warnings);

            comment = ResourceUtilities.FormatResourceString("General.SdkToolsPathToolDoesNotExist", _toolName, null, ToolLocationHelper.GetDotNetFrameworkSdkRootRegistryKey(TargetDotNetFrameworkVersion.Version45));
            _mockEngine.AssertLogDoesntContain(comment);
            Assert.Equal(0, _mockEngine.Errors);
        }