Skip to content

Commit 777a37f

Browse files
authored
Closing #141 - var guidance (#162)
* Add var guidance to xml * Remove global.json * Ignore vs vode .devcontainer * Move XMLtoMD project * Change Guideline to record from class * Add GuidelineXmlToMD mstest project * Implement GuidelineXmlFileReader test
1 parent 25ddd6e commit 777a37f

23 files changed

+118
-84
lines changed

.github/workflows/ConvertGuidelinesXmlToMarkdown.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
- name: restore_compile_run_createMD
4343
run: >
44-
dotnet run --configuration Release --project ./XMLtoMD/GuidelineXmlToMD/GuidelineXmlToMD.csproj
44+
dotnet run --configuration Release --project ./Tools/XMLtoMD/GuidelineXmlToMD/GuidelineXmlToMD.csproj
4545
-- --xml-input-file "./docs/${{ env.XmlFileName }}" --markdown-output-file "./docs/coding/csharp.md"
4646
if: ${{ steps.diff.outputs.modified == 'true' }}
4747

.github/workflows/manuallyRunXmlToMD.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
- name: restore_compile_run_createMD
3333
run: >
34-
dotnet run --configuration Release --project ./XMLtoMD/GuidelineXmlToMD/GuidelineXmlToMD.csproj
34+
dotnet run --configuration Release --project ./Tools/XMLtoMD/GuidelineXmlToMD/GuidelineXmlToMD.csproj
3535
-- --xml-input-file "./docs/${{ env.XmlFileName }}" --markdown-output-file "./docs/coding/csharp.md"
3636
3737
- name: Create commit and push to CodingGuideLinesMDUpdate

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,4 +349,5 @@ healthchecksdb
349349
MigrationBackup/
350350

351351
.idea
352-
.DS_Store
352+
.DS_Store
353+
.devcontainer
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Guidelines>
3+
<guideline key="name" severity="CONSIDER" section="Fencing" subsection="Who">My name is Inigo Montoya.</guideline>
4+
</Guidelines>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.IO;
5+
using System.Linq;
6+
7+
namespace GuidelineXmlToMD.Test
8+
{
9+
[TestClass]
10+
public class GuidelineXmlFileReaderTest
11+
{
12+
[TestMethod]
13+
public void ReadExisitingGuidelinesFile_ExistingFile_ReadsGuidlines()
14+
{
15+
// Arrange
16+
var projectPath = Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.FullName;
17+
var testPath = Path.Combine(projectPath, @"Data\", "TestGuidelines.xml");
18+
19+
// Act
20+
ICollection<Guideline> guidelines = GuidelineXmlFileReader.ReadExisitingGuidelinesFile(testPath);
21+
22+
// Assert
23+
var actual = guidelines.Single();
24+
var expected = new Guideline("name", "My name is Inigo Montoya.", "CONSIDER", "Fencing", "Who");
25+
Assert.AreEqual(expected, actual);
26+
27+
}
28+
}
29+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net5.0</TargetFramework>
5+
<NoWarn>CA2007,CA1815,CA1303,CA1707,CA1305,IDE0008,INTL0003</NoWarn>
6+
<IsPackable>false</IsPackable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
11+
<PackageReference Include="MSTest.TestAdapter" Version="2.1.1" />
12+
<PackageReference Include="MSTest.TestFramework" Version="2.1.1" />
13+
<PackageReference Include="coverlet.collector" Version="1.3.0" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<ProjectReference Include="..\GuidelineXmlToMD\GuidelineXmlToMD.csproj" />
18+
</ItemGroup>
19+
20+
</Project>

XMLtoMD/GuidelineXmlToMD/GuidelineXmlToMD.sln renamed to Tools/XMLtoMD/GuidelineXmlToMD.sln

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 16
44
VisualStudioVersion = 16.0.30225.117
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GuidelineXmlToMD", "GuidelineXmlToMD.csproj", "{D9C7CC15-01DB-46FE-922A-6EB41CE1759B}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GuidelineXmlToMD", "GuidelineXmlToMD\GuidelineXmlToMD.csproj", "{D9C7CC15-01DB-46FE-922A-6EB41CE1759B}"
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2D6BFDEE-B212-4BD3-A8D4-750F9BF9ACDE}"
99
ProjectSection(SolutionItems) = preProject
10-
..\..\.github\workflows\ConvertGuidelinesXmlToMarkdown.yml = ..\..\.github\workflows\ConvertGuidelinesXmlToMarkdown.yml
11-
..\..\docs\coding\csharp.md = ..\..\docs\coding\csharp.md
12-
..\..\docs\Guidelines(8th Edition).xml = ..\..\docs\Guidelines(8th Edition).xml
13-
..\..\.github\workflows\manuallyRunXmlToMD.yml = ..\..\.github\workflows\manuallyRunXmlToMD.yml
10+
..\..\..\.github\workflows\ConvertGuidelinesXmlToMarkdown.yml = ..\..\..\.github\workflows\ConvertGuidelinesXmlToMarkdown.yml
11+
..\..\..\docs\coding\csharp.md = ..\..\..\docs\coding\csharp.md
12+
..\..\..\docs\Guidelines(8th Edition).xml = ..\..\..\docs\Guidelines(8th Edition).xml
13+
..\..\..\.github\workflows\manuallyRunXmlToMD.yml = ..\..\..\.github\workflows\manuallyRunXmlToMD.yml
1414
EndProjectSection
1515
EndProject
16+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GuidelineXmlToMD.Test", "GuidelineXmlToMD.Test\GuidelineXmlToMD.Test.csproj", "{53970A22-98C6-4383-B4D4-03C698176FC5}"
17+
EndProject
1618
Global
1719
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1820
Debug|Any CPU = Debug|Any CPU
@@ -23,6 +25,10 @@ Global
2325
{D9C7CC15-01DB-46FE-922A-6EB41CE1759B}.Debug|Any CPU.Build.0 = Debug|Any CPU
2426
{D9C7CC15-01DB-46FE-922A-6EB41CE1759B}.Release|Any CPU.ActiveCfg = Release|Any CPU
2527
{D9C7CC15-01DB-46FE-922A-6EB41CE1759B}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{53970A22-98C6-4383-B4D4-03C698176FC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{53970A22-98C6-4383-B4D4-03C698176FC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{53970A22-98C6-4383-B4D4-03C698176FC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{53970A22-98C6-4383-B4D4-03C698176FC5}.Release|Any CPU.Build.0 = Release|Any CPU
2632
EndGlobalSection
2733
GlobalSection(SolutionProperties) = preSolution
2834
HideSolutionNode = FALSE
File renamed without changes.
File renamed without changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace GuidelineXmlToMD
2+
{
3+
public record Guideline(string Key, string Text, string Severity, string Section, string Subsection) { };
4+
}

0 commit comments

Comments
 (0)