-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw error when unknown file is found in csproj (legacy style). (#26)
Added unit test and changed other unittests that are impacted by this change.
- Loading branch information
1 parent
c45aac1
commit 27f91f0
Showing
5 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
Parsers.CommonTests/VisualStudio/Projects/LegacyStyleParserTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
namespace Parsers.CommonTests.VisualStudio.Projects | ||
{ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Xml.Linq; | ||
|
||
using FluentAssertions; | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
using Skyline.DataMiner.CICD.Parsers.Common.VisualStudio.Projects; | ||
|
||
[TestClass] | ||
public class LegacyStyleParserTests | ||
{ | ||
[TestMethod] | ||
public void GetCompileFilesTest() | ||
{ | ||
// Arrange | ||
string path = Path.GetFullPath(@".\VisualStudio\TestFiles\ProjectsForTesting\Files\Files_UnknownFile.csproj"); | ||
string projectDir = Path.GetDirectoryName(path); | ||
var xmlContent = File.ReadAllText(path, Encoding.UTF8); | ||
var document = XDocument.Parse(xmlContent); | ||
LegacyStyleParser legacyStyleParser = new LegacyStyleParser(document, projectDir); | ||
|
||
// Act | ||
Action action = () => _ = legacyStyleParser.GetCompileFiles().ToList(); | ||
|
||
// Assert | ||
action.Should().Throw<FileNotFoundException>(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters