Skip to content

Commit c51d61c

Browse files
Make tests pass for MSBuild projects
1 parent 7fb3823 commit c51d61c

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

test/assets.test.ts

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -121,31 +121,31 @@ suite("Asset generation: csproj", () => {
121121

122122
test("Create tasks.json for project opened in workspace", () => {
123123
let rootPath = path.resolve('testRoot');
124-
let info = createMSBuildWorkspaceInformation(rootPath, 'testApp.dll', 'netcoreapp1.0');
124+
let info = createMSBuildWorkspaceInformation(path.join(rootPath, 'testApp.csproj'), 'testApp', 'netcoreapp1.0');
125125
let generator = new AssetGenerator(info, rootPath);
126126
let tasksJson = generator.createTasksConfiguration();
127127
let buildPath = tasksJson.tasks[0].args[0];
128128

129129
// ${workspaceRoot}/project.json
130130
let segments = buildPath.split(path.sep);
131-
segments.should.deep.equal(['${workspaceRoot}', 'project.json']);
131+
segments.should.deep.equal(['${workspaceRoot}', 'testApp.csproj']);
132132
});
133133

134134
test("Create tasks.json for nested project opened in workspace", () => {
135135
let rootPath = path.resolve('testRoot');
136-
let info = createMSBuildWorkspaceInformation(path.join(rootPath, 'nested'), 'testApp.dll', 'netcoreapp1.0');
136+
let info = createMSBuildWorkspaceInformation(path.join(rootPath, 'nested', 'testApp.csproj'), 'testApp', 'netcoreapp1.0');
137137
let generator = new AssetGenerator(info, rootPath);
138138
let tasksJson = generator.createTasksConfiguration();
139139
let buildPath = tasksJson.tasks[0].args[0];
140140

141141
// ${workspaceRoot}/nested/project.json
142142
let segments = buildPath.split(path.sep);
143-
segments.should.deep.equal(['${workspaceRoot}', 'nested', 'project.json']);
143+
segments.should.deep.equal(['${workspaceRoot}', 'nested', 'testApp.csproj']);
144144
});
145145

146146
test("Create launch.json for project opened in workspace", () => {
147147
let rootPath = path.resolve('testRoot');
148-
let info = createMSBuildWorkspaceInformation(rootPath, 'testApp.dll', 'netcoreapp1.0');
148+
let info = createMSBuildWorkspaceInformation(path.join(rootPath, 'testApp.csproj'), 'testApp', 'netcoreapp1.0');
149149
let generator = new AssetGenerator(info, rootPath);
150150
let launchJson = generator.createLaunchJson(/*isWebProject*/ false);
151151
let programPath = launchJson.configurations[0].program;
@@ -157,7 +157,7 @@ suite("Asset generation: csproj", () => {
157157

158158
test("Create launch.json for nested project opened in workspace", () => {
159159
let rootPath = path.resolve('testRoot');
160-
let info = createMSBuildWorkspaceInformation(path.join(rootPath, 'nested'), 'testApp.dll', 'netcoreapp1.0');
160+
let info = createMSBuildWorkspaceInformation(path.join(rootPath, 'nested', 'testApp.csproj'), 'testApp', 'netcoreapp1.0');
161161
let generator = new AssetGenerator(info, rootPath);
162162
let launchJson = generator.createLaunchJson(/*isWebProject*/ false);
163163
let programPath = launchJson.configurations[0].program;
@@ -169,7 +169,7 @@ suite("Asset generation: csproj", () => {
169169

170170
test("Create launch.json for web project opened in workspace", () => {
171171
let rootPath = path.resolve('testRoot');
172-
let info = createMSBuildWorkspaceInformation(rootPath, 'testApp.dll', 'netcoreapp1.0');
172+
let info = createMSBuildWorkspaceInformation(path.join(rootPath, 'testApp.csproj'), 'testApp', 'netcoreapp1.0');
173173
let generator = new AssetGenerator(info, rootPath);
174174
let launchJson = generator.createLaunchJson(/*isWebProject*/ true);
175175
let programPath = launchJson.configurations[0].program;
@@ -181,7 +181,7 @@ suite("Asset generation: csproj", () => {
181181

182182
test("Create launch.json for nested web project opened in workspace", () => {
183183
let rootPath = path.resolve('testRoot');
184-
let info = createMSBuildWorkspaceInformation(path.join(rootPath, 'nested'), 'testApp.dll', 'netcoreapp1.0');
184+
let info = createMSBuildWorkspaceInformation(path.join(rootPath, 'nested', 'testApp.csproj'), 'testApp', 'netcoreapp1.0');
185185
let generator = new AssetGenerator(info, rootPath);
186186
let launchJson = generator.createLaunchJson(/*isWebProject*/ true);
187187
let programPath = launchJson.configurations[0].program;
@@ -192,34 +192,30 @@ suite("Asset generation: csproj", () => {
192192
});
193193
});
194194

195-
function createMSBuildWorkspaceInformation(projectPath: string, compilationOutputAssemblyFile: string, targetFrameworkShortName: string, emitEntryPoint: boolean = true) : protocol.WorkspaceInformationResponse {
195+
function createMSBuildWorkspaceInformation(projectPath: string, assemblyName: string, targetFrameworkShortName: string, isExe: boolean = true) : protocol.WorkspaceInformationResponse {
196196
return {
197-
DotNet: {
197+
MsBuild: {
198+
SolutionPath: '',
198199
Projects: [
199200
{
201+
ProjectGuid: '',
200202
Path: projectPath,
201-
Name: '',
202-
ProjectSearchPaths: [],
203-
Configurations: [
204-
{
205-
Name: 'Debug',
206-
CompilationOutputPath: '',
207-
CompilationOutputAssemblyFile: compilationOutputAssemblyFile,
208-
CompilationOutputPdbFile: '',
209-
EmitEntryPoint: emitEntryPoint
210-
}
211-
],
212-
Frameworks: [
203+
AssemblyName: assemblyName,
204+
TargetPath: '',
205+
TargetFramework: '',
206+
SourceFiles: [],
207+
TargetFrameworks: [
213208
{
214209
Name: '',
215210
FriendlyName: '',
216211
ShortName: targetFrameworkShortName
217212
}
218213
],
219-
SourceFiles: []
214+
OutputPath: '',
215+
IsExe: isExe,
216+
IsUnityProject: false
220217
}
221218
],
222-
RuntimePath: ''
223219
}
224220
};
225221
}

0 commit comments

Comments
 (0)