Initial project references changes (#11648)

* first changes for showing project references

* add tests

* fix interface and formatting

* add try so that project still gets loaded even if dependency project loading fails

* use instanceof

* add circular reference error
This commit is contained in:
Kim Santiago
2020-08-13 16:08:32 -07:00
committed by GitHub
parent d68433ec22
commit f3a48da3fa
9 changed files with 217 additions and 23 deletions

View File

@@ -10,7 +10,7 @@ import * as testUtils from './testUtils';
import * as constants from '../common/constants';
import { promises as fs } from 'fs';
import { Project, EntryType, TargetPlatform, SystemDatabase, DatabaseReferenceLocation } from '../models/project';
import { Project, EntryType, TargetPlatform, SystemDatabase, DatabaseReferenceLocation, DacpacReferenceProjectEntry, SqlProjectReferenceProjectEntry } from '../models/project';
import { exists, convertSlashesForSqlProj } from '../common/utils';
import { Uri } from 'vscode';
@@ -45,6 +45,20 @@ describe('Project: sqlproj content operations', function (): void {
// should only have one database reference even though there are two master.dacpac references (1 for ADS and 1 for SSDT)
should(project.databaseReferences.length).equal(1);
should(project.databaseReferences[0].databaseName).containEql(constants.master);
should(project.databaseReferences[0] instanceof DacpacReferenceProjectEntry).equal(true);
});
it('Should read Project with Project reference from sqlproj', async function (): Promise<void> {
projFilePath = await testUtils.createTestSqlProjFile(baselines.openProjectWithProjectReferencesBaseline);
const project: Project = await Project.openProject(projFilePath);
// Database references
// should only have two database references even though there are two master.dacpac references (1 for ADS and 1 for SSDT)
should(project.databaseReferences.length).equal(2);
should(project.databaseReferences[0].databaseName).containEql(constants.master);
should(project.databaseReferences[0] instanceof DacpacReferenceProjectEntry).equal(true);
should(project.databaseReferences[1].databaseName).containEql('TestProjectName');
should(project.databaseReferences[1] instanceof SqlProjectReferenceProjectEntry).equal(true);
});
it('Should add Folder and Build entries to sqlproj', async function (): Promise<void> {