示例#1
0
        public async Task AugmentFiles_Test()
        {
            EnsurePowerShellFilesDoNotExist(_scriptRootPath);

            var powerShellFileProvisioner = new TestPowerShellFileProvisioner(_loggerFactory);
            await powerShellFileProvisioner.ProvisionFiles(_scriptRootPath);

            File.Exists(Path.Combine(_scriptRootPath, RequirementsPsd1FileName));
            File.Exists(Path.Combine(_scriptRootPath, ProfilePs1FileName));

            string requirementsContent = File.ReadAllText(Path.Combine(_scriptRootPath, RequirementsPsd1FileName));
            string expectedContent     = FileUtility.ReadResourceString(RequirementsPsd1PSGalleryOnlineResourceFileName);

            Assert.Equal(expectedContent, requirementsContent, StringComparer.OrdinalIgnoreCase);

            ValidateLogs(_loggerProvider, _scriptRootPath);
        }
示例#2
0
        public async Task AugmentFiles_UnableToReachThePSGallery_Test()
        {
            EnsurePowerShellFilesDoNotExist(_scriptRootPath);

            var powerShellFileProvisioner = new TestPowerShellFileProvisioner(_loggerFactory)
            {
                GetLatestAzModuleMajorVersionThrowsException = true
            };
            await powerShellFileProvisioner.ProvisionFiles(_scriptRootPath);

            File.Exists(Path.Combine(_scriptRootPath, RequirementsPsd1FileName));
            File.Exists(Path.Combine(_scriptRootPath, ProfilePs1FileName));

            string requirementsContent = File.ReadAllText(Path.Combine(_scriptRootPath, RequirementsPsd1FileName));
            string expectedContent     = FileUtility.ReadResourceString(RequirementsPsd1PSGalleryOfflineResourceFileName);

            Assert.Equal(expectedContent, requirementsContent, StringComparer.OrdinalIgnoreCase);

            ValidateLogs(_loggerProvider, _scriptRootPath, unableToReachPSGallery: true);
        }