fun create()

in plugin-dotnet-agent/src/main/kotlin/jetbrains/buildServer/nunit/nUnitProject/NUnitProjectSerializer.kt [14:47]


    fun create(project: NUnitProject, outputStream: OutputStream) {
        val doc = _documentService.create()

        // Config element
        val configElement = doc.createElement(CONFIG_ELEMENT).also {
            it.setAttribute(NAME_ATTR, DEFAULT_CONFIG_NAME)
        }

        for (assembly in project.testingAssemblies) {
            val assemblyElement = doc.createElement(ASSEMBLY_ELEMENT)
            assemblyElement.setAttribute(PATH_ATTR, assembly.path)
            configElement.appendChild(assemblyElement)
        }

        val appConfigFileStr = _nUnitSettings.appConfigFile
        if (!appConfigFileStr.isNullOrBlank()) {
            val appConfigFile = _pathsService.resolvePath(PathType.Checkout, appConfigFileStr)
            configElement.setAttribute(CONFIG_FILE_ATTR, appConfigFile.toAbsolutePath().toString())
        }

        // Settings element
        val settingsElement = doc.createElement(SETTINGS_ELEMENT).also {
            it.setAttribute(ACTIVE_CONFIG_ATTR, DEFAULT_CONFIG_NAME)
            it.setAttribute(APPBASE_ATTR, project.appBase.path)
        }

        val nUnitProjectElement = doc.createElement(NUNIT_PROJECT_ELEMENT).also {
            it.appendChild(settingsElement)
            it.appendChild(configElement)
        }

        doc.appendChild(nUnitProjectElement)
        _documentService.serialize(doc, outputStream)
    }