Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions bin/add-practice-exercise.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,23 @@ $exerciseName = (Get-Culture).TextInfo.ToTitleCase($Exercise).Replace("-", "")
$exerciseDir = "exercises/practice/${Exercise}"
$projectFile = "${exerciseDir}/${ExerciseName}.csproj"
& dotnet new install xunit.v3.templates
& dotnet new xunit3 --force --output $exerciseDir --name $ExerciseName
& dotnet new xunit3 --force --framework net9.0 --output $exerciseDir --name $ExerciseName
& dotnet sln exercises/Exercises.sln add $projectFile

[xml]$project = Get-Content $projectFile
$project.Project.PropertyGroup.RemoveChild($project.Project.PropertyGroup.SelectSingleNode("//comment()"))
$project.Project.PropertyGroup.RemoveChild($project.Project.PropertyGroup.SelectSingleNode("//RootNamespace"))
$restorePackagesWithLockFileElement = $project.CreateElement("RestorePackagesWithLockFile");
$restorePackagesWithLockFileElement.InnerText = "true"
$project.Project.PropertyGroup.AppendChild($restorePackagesWithLockFileElement)
$project.Project.RemoveChild($project.Project.ItemGroup[0])
$project.Project.ItemGroup[1].SelectSingleNode("PackageReference[@Include='Microsoft.NET.Test.Sdk']").SetAttribute("Version", "17.12.0")
$project.Project.ItemGroup[1].SelectSingleNode("PackageReference[@Include='xunit.v3']").SetAttribute("Version", "1.1.0")
$project.Project.ItemGroup[1].SelectSingleNode("PackageReference[@Include='xunit.runner.visualstudio']").SetAttribute("Version", "3.0.2")
$project.Project.ItemGroup[1].SelectSingleNode("PackageReference[@Include='xunit.runner.visualstudio']").SetAttribute("Version", "3.0.1")
$project.Save($projectFile)

dotnet add $projectFile package Exercism.Tests.xunit.v3 --version 0.1.0-beta1

# Remove and update files
Remove-Item -Path "${exerciseDir}/xunit.runner.json"
Remove-Item -Path "${exerciseDir}/UnitTest1.cs"
Expand Down
3 changes: 0 additions & 3 deletions generators/TemplateGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ private static bool ExpectsError(this JsonNode testCase) =>
testCase["expected"] is JsonObject jsonObject && jsonObject.ContainsKey("error");

private const string GeneratorTemplate = @"
{{ if error }}using System;{{ end }}
using Xunit;

public class {%{{{ testClass }}}%}
{
{%{{{- for test in tests }}}%}
Expand Down
Loading