Tests for round tripping with SSDT projects (#10646)

* Test code for round tripping feature

* Fixed tests. Edited updateImportedTargetsToProjFile method to push newly added import target to the list.

* Added couple more tests

* Addressed comment
This commit is contained in:
Sakshi Sharma
2020-06-03 14:02:50 -07:00
committed by GitHub
parent 3860f07cab
commit c903112451
8 changed files with 260 additions and 20 deletions

View File

@@ -72,7 +72,7 @@ export class ProjectsController {
this.projects.push(newProject);
// Update for round tripping as needed
await newProject.updateProjectForRoundTrip();
await this.updateProjectForRoundTrip(newProject);
// Read datasources.json (if present)
const dataSourcesFilePath = path.join(path.dirname(projectFile.fsPath), constants.dataSourcesFileName);
@@ -298,6 +298,17 @@ export class ProjectsController {
return new DeployDatabaseDialog(this.apiWrapper, project);
}
public async updateProjectForRoundTrip(project: Project) {
if (project.importedTargets.includes(constants.NetCoreTargets)) {
return;
}
const result = await this.apiWrapper.showWarningMessage(constants.updateProjectForRoundTrip, constants.yesString, constants.noString);
if (result === constants.yesString) {
await project.updateProjectForRoundTrip();
}
}
private static getProjectFromContext(context: Project | BaseProjectTreeItem) {
if (context instanceof Project) {
return context;