public void Invoke_InvalidFiles_WritesErrorsToConsole()
        {
            var fileSystem = MockFileSystemFactory.CreateFileSystemWithInvalidFiles();
            var mockMainArmTemplateFileData = fileSystem.GetFile(MainArmTemplateFile.FileName);
            var processProxy = MockProcessProxyFactory.CreateProcessProxy(callback: () => fileSystem.SetTempFile(mockMainArmTemplateFileData));

            var console = new MockConsole().ExpectErrorLines(
                $@"The file ""{fileSystem.Path.GetFullPath(MainArmTemplateParametersFile.FileName)}"" is invalid:
  #/parameters/dnsPrefix: Expected 1 matching subschema but found 0
  #/parameters/dnsPrefix: Required properties [value] were not present
  #/parameters/dnsPrefix: Required properties [reference] were not present
  #/parameters/linuxAdminUsername: Expected 1 matching subschema but found 0
  #/parameters/linuxAdminUsername: Required properties [value] were not present
  #/parameters/linuxAdminUsername: Required properties [reference] were not present
".ReplaceLineEndings(),
                $@"The file ""{fileSystem.Path.GetFullPath(MetadataFile.FileName)}"" is invalid:
  #/description: Value is not longer than or equal to 10 characters
  #/summary: Value is not longer than or equal to 10 characters
".ReplaceLineEndings(),
                $@"The file ""{fileSystem.Path.GetFullPath(ReadmeFile.FileName)}"" is modified or outdated. Please regenerate the file to fix it.
".ReplaceLineEndings(),
                $@"The file ""{fileSystem.Path.GetFullPath(VersionFile.FileName)}"" is modified or outdated. Please regenerate the file to fix it.
".ReplaceLineEndings());

            Invoke(fileSystem, processProxy, console);

            console.Verify();
        }
Ejemplo n.º 2
0
        public void Invoke_InvalidFiles_WritesErrorsToConsole()
        {
            var fileSystem = MockFileSystemFactory.CreateFileSystemWithInvalidFiles();
            var mockMainArmTemplateFileData = fileSystem.GetFile(MainArmTemplateFile.FileName);
            var processProxy = MockProcessProxyFactory.CreateProcessProxy(
                (args => args.Contains(MainBicepFile.FileName), () => fileSystem.SetTempFile(mockMainArmTemplateFileData)),
                (args => args.Contains(MainBicepTestFile.FileName), () => fileSystem.SetTempFile(MockInvalidMainTestArmTemplateData)));

            var console = new MockConsole().ExpectErrorLines(
                $@"The file ""{fileSystem.Path.GetFullPath(MainBicepFile.FileName)}"" is invalid. Descriptions for the following parameters are missing:
  - dnsPrefix
  - servicePrincipalClientSecret

The file ""{fileSystem.Path.GetFullPath(MainBicepFile.FileName)}"" is invalid. Descriptions for the following outputs are missing:
  - controlPlaneFQDN
".ReplaceLineEndings(),
                $@"The file ""{fileSystem.Path.GetFullPath($"test/{MainBicepTestFile.FileName}")}"" is invalid. Could not find tests in the file. Please make sure to add at least one module referencing the main Bicep file.
".ReplaceLineEndings(),
                $@"The file ""{fileSystem.Path.GetFullPath(MetadataFile.FileName)}"" is invalid:
  #/summary: Value is not longer than or equal to 10 characters
".ReplaceLineEndings(),
                $@"The file ""{fileSystem.Path.GetFullPath(ReadmeFile.FileName)}"" is modified or outdated. Please regenerate the file to fix it.
".ReplaceLineEndings(),
                $@"The file ""{fileSystem.Path.GetFullPath(VersionFile.FileName)}"" is invalid:
  #: Required properties [""$schema"",""version"",""pathFilters""] were not present
".ReplaceLineEndings());

            Invoke(fileSystem, processProxy, console);

            console.Verify();
        }
        public void Invoke_InvalidFiles_ReturnsOne()
        {
            var fileSystem = MockFileSystemFactory.CreateFileSystemWithInvalidFiles();
            var mockMainArmTemplateFileData = fileSystem.GetFile(MainArmTemplateFile.FileName);
            var processProxy = MockProcessProxyFactory.CreateProcessProxy(callback: () => fileSystem.SetTempFile(mockMainArmTemplateFileData));

            var exitCode = Invoke(fileSystem, processProxy);

            exitCode.Should().Be(1);
        }
Ejemplo n.º 4
0
        public void Invoke_InvalidFiles_ReturnsOne()
        {
            var fileSystem = MockFileSystemFactory.CreateFileSystemWithInvalidFiles();
            var mockMainArmTemplateFileData = fileSystem.GetFile(MainArmTemplateFile.FileName);
            var processProxy = MockProcessProxyFactory.CreateProcessProxy(
                (args => args.Contains(MainBicepFile.FileName), () => fileSystem.SetTempFile(mockMainArmTemplateFileData)),
                (args => args.Contains(MainBicepTestFile.FileName), () => fileSystem.SetTempFile(MockInvalidMainTestArmTemplateData)));

            var exitCode = Invoke(fileSystem, processProxy);

            exitCode.Should().Be(1);
        }