From f5404b1e046265dea122bfddb5bdb3feac87bca7 Mon Sep 17 00:00:00 2001 From: Daniel-iel Date: Thu, 30 May 2024 17:34:55 -0300 Subject: [PATCH] =?UTF-8?q?Melhorias=20em=20reuso=20de=20c=C3=B3digo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 + .../Analyzers/AnalyzerAndFixerTest.cs | 75 ++++++------------- .../Analyzers/AnalyzerRunnerTest.cs | 44 +++++------ src/ByReplace.Test/Analyzers/AnalyzerTest.cs | 28 +++---- .../Analyzers/DocumentFixTest.cs | 36 ++++----- .../Builders/BrConfigurationBuilderTest.cs | 8 +- src/ByReplace.Test/ByReplace.Test.csproj | 8 +- .../ClassFixture/WorkspaceFixture.cs | 55 ++++++++++++++ .../Apply/Rule/ApplyRuleCommandTest.cs | 45 ++--------- .../Apply/Rules/ApplyRulesCommandTest.cs | 44 ++--------- .../Rule/ListRules/ListRulesCommandTest.cs | 47 ++---------- .../Commands/Rule/ListRules/RulesBoxTest.cs | 15 ++-- .../Rule/OpenRule/OpenRuleCommandTest.cs | 34 +++++---- .../Commands/Rule/OpenRule/RuleBoxTest.cs | 10 +-- .../Common/FolderMock/FolderSyntax.cs | 2 +- .../Common/FolderMock/PathFactory.cs | 7 -- .../Common/FolderMock/WorkspaceFactory.cs | 7 ++ ...ompilationSyntax.cs => WorkspaceSyntax.cs} | 30 ++++---- .../Mappers/DirectoryThreeTest.cs | 10 +-- .../Models/BrConfigurationTest.cs | 14 ++-- 20 files changed, 230 insertions(+), 292 deletions(-) create mode 100644 src/ByReplace.Test/ClassFixture/WorkspaceFixture.cs delete mode 100644 src/ByReplace.Test/Common/FolderMock/PathFactory.cs create mode 100644 src/ByReplace.Test/Common/FolderMock/WorkspaceFactory.cs rename src/ByReplace.Test/Common/FolderMock/{PathCompilationSyntax.cs => WorkspaceSyntax.cs} (64%) diff --git a/.gitignore b/.gitignore index 926eac4..301bba0 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,9 @@ StrykerOutput */StrykerOutput/* */StrykerOutput/ +*/coverage.opencover.xml +coverage.opencover.xml + src/**/nupkg/* */src/*/nupkg/* .user diff --git a/src/ByReplace.Test/Analyzers/AnalyzerAndFixerTest.cs b/src/ByReplace.Test/Analyzers/AnalyzerAndFixerTest.cs index 27d78a6..9ea322c 100644 --- a/src/ByReplace.Test/Analyzers/AnalyzerAndFixerTest.cs +++ b/src/ByReplace.Test/Analyzers/AnalyzerAndFixerTest.cs @@ -1,50 +1,19 @@ using ByReplace.Analyzers; -using ByReplace.Builders; -using ByReplace.Models; using ByReplace.Printers; -using ByReplace.Test.Common.ConfigMock; -using ByReplace.Test.Common.FolderMock; +using ByReplace.Test.ClassFixture; using Moq; using Xunit; namespace ByReplace.Test.Analyzers; -public class AnalyzerAndFixerTest +public class AnalyzerAndFixerTest : IClassFixture { - private readonly PathCompilationSyntax _pathCompilationSyntax; - private readonly BrConfiguration _brConfiguration; + private readonly WorkspaceFixture _workspace; private readonly Mock _printMock; - public AnalyzerAndFixerTest() + public AnalyzerAndFixerTest(WorkspaceFixture workspace) { - var configContent = BrContentFactory - .CreateDefault() - .AddConfig(BrContentFactory.ConfigNoPathDeclaration("obj", ".bin")) - .AddRules(BrContentFactory - .Rule("RuleTest") - .WithExtensions(".cs", ".txt") - .WithSkips("**\\Controllers\\*", "bin\\bin1.txt", "obj\\obj2.txt") - .WithReplacement(BrContentFactory.Replacement("Test", "Test2"))) - .Compile(); - - var rootFolder = FolderSyntax - .FolderDeclaration("RootFolder") - .AddMembers( - FileSyntax.FileDeclaration("RootFile1.cs", "ITest = new Test()"), - FileSyntax.FileDeclaration("RootFile2.cs", "ITest = new Test()")); - - _pathCompilationSyntax = PathFactory - .Compile(nameof(AnalyzerAndFixerTest)) - .AddMembers(rootFolder) - .AddBrConfiguration(configContent) - .Create(); - - _brConfiguration = BrConfigurationBuilder - .Create() - .SetPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .SetConfigPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .Build(); - + _workspace = workspace; _printMock = new Mock(); } @@ -52,44 +21,44 @@ public AnalyzerAndFixerTest() public void TryMatchRule_MapTheFilesThatMatchToRule_ShouldReturnFilesThatMatch() { // Arrange - var analyzer = new Analyzer(_brConfiguration, _printMock.Object); + var analyzer = new Analyzer(_workspace.BrConfiguration, _printMock.Object); var analyzerAndFixer = new AnalyzerAndFixer(_printMock.Object); // Act var directoryNode = analyzer.LoadThreeFiles().Last(); - analyzerAndFixer.TryMatchRule(directoryNode, _brConfiguration.Rules); + analyzerAndFixer.TryMatchRule(directoryNode, _workspace.BrConfiguration.Rules); // Assert Assert.Equal(2, analyzerAndFixer.Count); Assert.Collection(analyzerAndFixer, - entry => - { - Assert.Equal("RootFile1.cs", entry.Key.Name); - Assert.Equal(".cs", entry.Key.Extension); - Assert.Collection(entry.Value, rule => Assert.Equal("RuleTest", rule.Name)); - }, - entry => - { - Assert.Equal("RootFile2.cs", entry.Key.Name); - Assert.Equal(".cs", entry.Key.Extension); - Assert.Collection(entry.Value, rule => Assert.Equal("RuleTest", rule.Name)); - }); + entry => + { + Assert.Equal("RootFile1.cs", entry.Key.Name); + Assert.Equal(".cs", entry.Key.Extension); + Assert.Collection(entry.Value, rule => Assert.Equal("RuleTest", rule.Name)); + }, + entry => + { + Assert.Equal("RootFile2.cs", entry.Key.Name); + Assert.Equal(".cs", entry.Key.Extension); + Assert.Collection(entry.Value, rule => Assert.Equal("RuleTest", rule.Name)); + }); } [Fact] public void TryMatchRule_WhenMapTheFilesThatMatchToRule_ShouldValidateLogWasCalled() { // Arrange - var analyzer = new Analyzer(_brConfiguration, _printMock.Object); + var analyzer = new Analyzer(_workspace.BrConfiguration, _printMock.Object); var analyzerAndFixer = new AnalyzerAndFixer(_printMock.Object); // Act var directoryNode = analyzer.LoadThreeFiles().Last(); - analyzerAndFixer.TryMatchRule(directoryNode, _brConfiguration.Rules); + analyzerAndFixer.TryMatchRule(directoryNode, _workspace.BrConfiguration.Rules); // Assert _printMock.Verify(x => x.Information("[Cyan]1 rules in total match the file [Cyan]RootFile1.cs."), Times.Once); _printMock.Verify(x => x.Information("[Cyan]1 rules in total match the file [Cyan]RootFile2.cs."), Times.Once); } -} +} \ No newline at end of file diff --git a/src/ByReplace.Test/Analyzers/AnalyzerRunnerTest.cs b/src/ByReplace.Test/Analyzers/AnalyzerRunnerTest.cs index 55c70f3..9fcf799 100644 --- a/src/ByReplace.Test/Analyzers/AnalyzerRunnerTest.cs +++ b/src/ByReplace.Test/Analyzers/AnalyzerRunnerTest.cs @@ -1,7 +1,7 @@ using ByReplace.Analyzers; using ByReplace.Builders; -using ByReplace.Models; using ByReplace.Printers; +using ByReplace.Test.ClassFixture; using ByReplace.Test.Common.ConfigMock; using ByReplace.Test.Common.FolderMock; using Moq; @@ -9,15 +9,19 @@ namespace ByReplace.Test.Analyzers; -public class AnalyzerRunnerTest +public class AnalyzerRunnerTest : IClassFixture { - private readonly PathCompilationSyntax _pathCompilationSyntax; - private readonly BrConfiguration _brConfiguration; + private readonly WorkspaceFixture _workspace; private readonly Mock _printMock; - public AnalyzerRunnerTest() + public AnalyzerRunnerTest(WorkspaceFixture workspace) { - var configContent = BrContentFactory + _workspace = workspace; + _printMock = new Mock(); + + workspace.ClearPrevious(); + + _workspace.ConfigContent = BrContentFactory .CreateDefault() .AddConfig(BrContentFactory.ConfigNoPathDeclaration("obj", ".bin")) .AddRules(BrContentFactory @@ -29,49 +33,47 @@ public AnalyzerRunnerTest() var rootFolder = FolderSyntax .FolderDeclaration("RootFolder") - .AddMembers( + .AddFiles( FileSyntax.FileDeclaration("RootFile1.cs", "ITest = new Test()"), FileSyntax.FileDeclaration("RootFile2.cs", "ITest = new Test()")); var controllerFolder = FolderSyntax.FolderDeclaration("Controllers") .AddParent(rootFolder) - .AddMembers( + .AddFiles( FileSyntax.FileDeclaration("Controller1.cs", "ITest2 = new Test()"), FileSyntax.FileDeclaration("Controller2.cs", "ITest2 = new Test()")); var binFolder = FolderSyntax.FolderDeclaration("bin") .AddParent(rootFolder) - .AddMembers( + .AddFiles( FileSyntax.FileDeclaration("bin1.txt", "ITest = new Test()"), FileSyntax.FileDeclaration("bin2.txt", "ITest = new Test()")); var objFolder = FolderSyntax.FolderDeclaration("obj") .AddParent(rootFolder) - .AddMembers( + .AddFiles( FileSyntax.FileDeclaration("obj1.txt", "ITest = new Test()"), FileSyntax.FileDeclaration("obj2.txt", "ITest = new Test()")); - _pathCompilationSyntax = PathFactory + _workspace.WorkspaceSyntax = WorkspaceFactory .Compile(nameof(AnalyzerRunnerTest)) .AddMembers(controllerFolder, binFolder, objFolder) - .AddBrConfiguration(configContent) + .AddBrConfiguration(_workspace.ConfigContent) .Create(); - _brConfiguration = BrConfigurationBuilder + _workspace.BrConfiguration = BrConfigurationBuilder .Create() - .SetPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .SetConfigPath($"./{_pathCompilationSyntax.InternalIdentifier}") + .SetPath($"./{_workspace.WorkspaceSyntax.Identifier}") + .SetConfigPath($"./{_workspace.WorkspaceSyntax.Identifier}") .Build(); - - _printMock = new Mock(); } [Fact] public void RunAnalysis_MapAllRulesThatMatchToFileInSourceTree_ShouldReturnRulesThatMatch() { // Arrange - var analyzer = new Analyzer(_brConfiguration, _printMock.Object); - var analyzerRunner = new AnalyzerRunner(_brConfiguration, _printMock.Object); + var analyzer = new Analyzer(_workspace.BrConfiguration, _printMock.Object); + var analyzerRunner = new AnalyzerRunner(_workspace.BrConfiguration, _printMock.Object); // Act var directoryNodes = analyzer.LoadThreeFiles(); @@ -114,8 +116,8 @@ public void RunAnalysis_MapAllRulesThatMatchToFileInSourceTree_ShouldReturnRules public void RunAnalysis_WhenPrintLogInformation_ShouldValidateLogWasCalled() { // Arrange - var analyzer = new Analyzer(_brConfiguration, _printMock.Object); - var analyzerRunner = new AnalyzerRunner(_brConfiguration, _printMock.Object); + var analyzer = new Analyzer(_workspace.BrConfiguration, _printMock.Object); + var analyzerRunner = new AnalyzerRunner(_workspace.BrConfiguration, _printMock.Object); // Act var directoryNodes = analyzer.LoadThreeFiles(); diff --git a/src/ByReplace.Test/Analyzers/AnalyzerTest.cs b/src/ByReplace.Test/Analyzers/AnalyzerTest.cs index e20d2a9..d302327 100644 --- a/src/ByReplace.Test/Analyzers/AnalyzerTest.cs +++ b/src/ByReplace.Test/Analyzers/AnalyzerTest.cs @@ -1,21 +1,25 @@ using ByReplace.Analyzers; using ByReplace.Builders; -using ByReplace.Models; using ByReplace.Printers; +using ByReplace.Test.ClassFixture; using ByReplace.Test.Common.FolderMock; using Moq; using Xunit; namespace ByReplace.Test.Analyzers; -public class AnalyzerTest +public class AnalyzerTest : IClassFixture { - private readonly PathCompilationSyntax _pathCompilationSyntax; - private readonly BrConfiguration _brConfiguration; + private readonly WorkspaceFixture _workspace; private readonly Mock _printMock; - public AnalyzerTest() + public AnalyzerTest(WorkspaceFixture workspace) { + _workspace = workspace; + _printMock = new Mock(); + + _workspace.ClearPrevious(); + var rootFolder = FolderSyntax .FolderDeclaration("RootFolder") .AddMembers(FileSyntax.FileDeclaration("FileOne.cs", "ITest = new Test()")); @@ -24,25 +28,23 @@ public AnalyzerTest() .AddParent(rootFolder) .AddMembers(FileSyntax.FileDeclaration("FileSecond.cs", "ITest2 = new Test()")); - _pathCompilationSyntax = PathFactory + _workspace.WorkspaceSyntax = WorkspaceFactory .Compile(nameof(AnalyzerTest)) .AddMembers(firstLevel) .Create(); - _brConfiguration = BrConfigurationBuilder + _workspace.BrConfiguration = BrConfigurationBuilder .Create() - .SetPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .SetConfigPath($"./{_pathCompilationSyntax.InternalIdentifier}") + .SetPath($"./{_workspace.WorkspaceSyntax.Identifier}") + .SetConfigPath($"./{_workspace.WorkspaceSyntax.Identifier}") .Build(); - - _printMock = new Mock(); } [Fact] public void LoadThreeFiles_MapAllSourceThreeOfDirectory_ShouldReturnSourceFileThree() { // Arrange - var analyzer = new Analyzer(_brConfiguration, _printMock.Object); + var analyzer = new Analyzer(_workspace.BrConfiguration, _printMock.Object); // Act var directoryNodes = analyzer.LoadThreeFiles(); @@ -59,7 +61,7 @@ public void LoadThreeFiles_MapAllSourceThreeOfDirectory_ShouldReturnSourceFileTh public void LoadThreeFiles_WhenPrintLogInformation_ShouldValidateLogWasCalled() { // Arrange - var analyzer = new Analyzer(_brConfiguration, _printMock.Object); + var analyzer = new Analyzer(_workspace.BrConfiguration, _printMock.Object); // Act var directoryNodes = analyzer.LoadThreeFiles(); diff --git a/src/ByReplace.Test/Analyzers/DocumentFixTest.cs b/src/ByReplace.Test/Analyzers/DocumentFixTest.cs index e279868..4d643b5 100644 --- a/src/ByReplace.Test/Analyzers/DocumentFixTest.cs +++ b/src/ByReplace.Test/Analyzers/DocumentFixTest.cs @@ -1,7 +1,7 @@ using ByReplace.Analyzers; using ByReplace.Builders; -using ByReplace.Models; using ByReplace.Printers; +using ByReplace.Test.ClassFixture; using ByReplace.Test.Common.ConfigMock; using ByReplace.Test.Common.FolderMock; using Moq; @@ -9,14 +9,16 @@ namespace ByReplace.Test.Analyzers; -public class DocumentFixTest +public class DocumentFixTest : IClassFixture { - private readonly PathCompilationSyntax _pathCompilationSyntax; - private readonly BrConfiguration _brConfiguration; + private readonly WorkspaceFixture _workspace; private readonly Mock _printMock; - public DocumentFixTest() + public DocumentFixTest(WorkspaceFixture workspace) { + _workspace = workspace; + _printMock = new Mock(); + var configContent = BrContentFactory .CreateDefault() .AddConfig(BrContentFactory.ConfigNoPathDeclaration("obj", ".bin")) @@ -34,33 +36,31 @@ public DocumentFixTest() var rootFolder = FolderSyntax .FolderDeclaration("RootFolder") - .AddMembers( + .AddFiles( FileSyntax.FileDeclaration("RootFile1.cs", "var test = new Test2()"), FileSyntax.FileDeclaration("RootFile1.txt", "var test = new Test2()")); - _pathCompilationSyntax = PathFactory + _workspace.WorkspaceSyntax = WorkspaceFactory .Compile(nameof(DocumentFixTest)) .AddMembers(rootFolder) .AddBrConfiguration(configContent) - .Create(); + .Create(); - _brConfiguration = BrConfigurationBuilder - .Create() - .SetPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .SetConfigPath($"./{_pathCompilationSyntax.InternalIdentifier}") + _workspace.BrConfiguration = BrConfigurationBuilder + .Create() + .SetPath($"./{_workspace.WorkspaceSyntax.Identifier}") + .SetConfigPath($"./{_workspace.WorkspaceSyntax.Identifier}") .Build(); - - _printMock = new Mock(); } [Fact] public async Task ApplyAsync_WhenPassAllRules_ShouldApplyTheRulesInAllFilesAsync() { // Arrange - var analyzer = new Analyzer(_brConfiguration, _printMock.Object); + var analyzer = new Analyzer(_workspace.BrConfiguration, _printMock.Object); var analyzerAndFixer = new AnalyzerAndFixer(_printMock.Object); var directoryNode = analyzer.LoadThreeFiles().Last(); - analyzerAndFixer.TryMatchRule(directoryNode, _brConfiguration.Rules); + analyzerAndFixer.TryMatchRule(directoryNode, _workspace.BrConfiguration.Rules); var documentFix = new DocumentFix(analyzerAndFixer, _printMock.Object); // Act @@ -80,10 +80,10 @@ public async Task ApplyAsync_WhenPassAllRules_ShouldApplyTheRulesInAllFilesAsync public async Task ApplyAsync_WhenPassOnlyOneRule_ShouldApplyTheRuleInAllFiles() { // Arrange - var analyzer = new Analyzer(_brConfiguration, _printMock.Object); + var analyzer = new Analyzer(_workspace.BrConfiguration, _printMock.Object); var analyzerAndFixer = new AnalyzerAndFixer(_printMock.Object); var directoryNode = analyzer.LoadThreeFiles().Last(); - analyzerAndFixer.TryMatchRule(directoryNode, _brConfiguration.Rules); + analyzerAndFixer.TryMatchRule(directoryNode, _workspace.BrConfiguration.Rules); var documentFix = new DocumentFix(analyzerAndFixer, _printMock.Object); // Act diff --git a/src/ByReplace.Test/Builders/BrConfigurationBuilderTest.cs b/src/ByReplace.Test/Builders/BrConfigurationBuilderTest.cs index 4521165..5485ac8 100644 --- a/src/ByReplace.Test/Builders/BrConfigurationBuilderTest.cs +++ b/src/ByReplace.Test/Builders/BrConfigurationBuilderTest.cs @@ -7,7 +7,7 @@ namespace ByReplace.Test.Builders; public class BrConfigurationBuilderTest { - private readonly PathCompilationSyntax _pathCompilationSyntax; + private readonly WorkspaceSyntax _workspaceSyntax; public BrConfigurationBuilderTest() { @@ -23,7 +23,7 @@ public BrConfigurationBuilderTest() .WithReplacement(BrContentFactory.Replacement("Test", "Test2"))) .Compile(); - _pathCompilationSyntax = PathFactory + _workspaceSyntax = WorkspaceFactory .Compile(nameof(BrConfigurationBuilderTest)) .AddMember(rootFolder) .AddBrConfiguration(configContent) @@ -34,8 +34,8 @@ public BrConfigurationBuilderTest() public void Build_ReturnsCorrectConfiguration() { // Arrange - var configFile = $"./{_pathCompilationSyntax.InternalIdentifier}"; - var path = $"./{_pathCompilationSyntax.InternalIdentifier}"; + var configFile = $"./{_workspaceSyntax.Identifier}"; + var path = $"./{_workspaceSyntax.Identifier}"; const string rule = "RuleTest"; var builder = BrConfigurationBuilder diff --git a/src/ByReplace.Test/ByReplace.Test.csproj b/src/ByReplace.Test/ByReplace.Test.csproj index 8a62a07..c57c1d8 100644 --- a/src/ByReplace.Test/ByReplace.Test.csproj +++ b/src/ByReplace.Test/ByReplace.Test.csproj @@ -10,10 +10,6 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - @@ -23,6 +19,10 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/ByReplace.Test/ClassFixture/WorkspaceFixture.cs b/src/ByReplace.Test/ClassFixture/WorkspaceFixture.cs new file mode 100644 index 0000000..db12cf0 --- /dev/null +++ b/src/ByReplace.Test/ClassFixture/WorkspaceFixture.cs @@ -0,0 +1,55 @@ +using ByReplace.Builders; +using ByReplace.Models; +using ByReplace.Test.Commands.Apply.Rules; +using ByReplace.Test.Common.ConfigMock; +using ByReplace.Test.Common.FolderMock; + +namespace ByReplace.Test.ClassFixture; + +public class WorkspaceFixture : IDisposable +{ + internal WorkspaceSyntax WorkspaceSyntax { get; set; } + internal BrConfiguration BrConfiguration { get; set; } + internal ContentSyntax ConfigContent { get; set; } + + public WorkspaceFixture() + { + ConfigContent = BrContentFactory + .CreateDefault() + .AddConfig(BrContentFactory.ConfigNoPathDeclaration("obj", ".bin")) + .AddRules(BrContentFactory + .Rule("RuleTest") + .WithExtensions(".cs", ".txt") + .WithSkips("**\\Controllers\\*", "bin\\bin1.txt", "obj\\obj2.txt") + .WithReplacement(BrContentFactory.Replacement("Test", "Test2"))) + .Compile(); + + var rootFolder = FolderSyntax + .FolderDeclaration("RootFolder") + .AddFiles( + FileSyntax.FileDeclaration("RootFile1.cs", "ITest = new Test()"), + FileSyntax.FileDeclaration("RootFile2.cs", "ITest = new Test()")); + + WorkspaceSyntax = WorkspaceFactory + .Compile(nameof(ApplyRulesCommandTest)) + .AddMembers(rootFolder) + .AddBrConfiguration(ConfigContent) + .Create(); + + BrConfiguration = BrConfigurationBuilder + .Create() + .SetPath($"./{WorkspaceSyntax.Identifier}") + .SetConfigPath($"./{WorkspaceSyntax.Identifier}") + .Build(); + } + + public void ClearPrevious() + { + Dispose(); + } + + public void Dispose() + { + Directory.Delete($"./{WorkspaceSyntax.Identifier}", true); + } +} \ No newline at end of file diff --git a/src/ByReplace.Test/Commands/Apply/Rule/ApplyRuleCommandTest.cs b/src/ByReplace.Test/Commands/Apply/Rule/ApplyRuleCommandTest.cs index 374af07..8211e27 100644 --- a/src/ByReplace.Test/Commands/Apply/Rule/ApplyRuleCommandTest.cs +++ b/src/ByReplace.Test/Commands/Apply/Rule/ApplyRuleCommandTest.cs @@ -1,51 +1,20 @@ -using ByReplace.Builders; -using ByReplace.Commands.Apply.Rule; -using ByReplace.Models; +using ByReplace.Commands.Apply.Rule; using ByReplace.Printers; -using ByReplace.Test.Common.ConfigMock; -using ByReplace.Test.Common.FolderMock; +using ByReplace.Test.ClassFixture; using Moq; using Xunit; namespace ByReplace.Test.Commands.Apply.Rule; -public class ApplyRuleCommandTest +public class ApplyRuleCommandTest : IClassFixture { - private readonly PathCompilationSyntax _pathCompilationSyntax; - private readonly BrConfiguration _brConfiguration; + private readonly WorkspaceFixture _workspace; private readonly Mock _printMock; - public ApplyRuleCommandTest() + public ApplyRuleCommandTest(WorkspaceFixture workspace) { + _workspace = workspace; _printMock = new Mock(); - - var configContent = BrContentFactory - .CreateDefault() - .AddConfig(BrContentFactory.ConfigNoPathDeclaration("obj", ".bin")) - .AddRules(BrContentFactory - .Rule("RuleTest") - .WithExtensions(".cs", ".txt") - .WithSkips("**\\Controllers\\*", "bin\\bin1.txt", "obj\\obj2.txt") - .WithReplacement(BrContentFactory.Replacement("Test", "Test2"))) - .Compile(); - - var rootFolder = FolderSyntax - .FolderDeclaration("RootFolder") - .AddMembers( - FileSyntax.FileDeclaration("RootFile1.cs", "ITest = new Test()"), - FileSyntax.FileDeclaration("RootFile2.cs", "ITest = new Test()")); - - _pathCompilationSyntax = PathFactory - .Compile(nameof(ApplyRuleCommandTest)) - .AddMembers(rootFolder) - .AddBrConfiguration(configContent) - .Create(); - - _brConfiguration = BrConfigurationBuilder - .Create() - .SetPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .SetConfigPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .Build(); } [Fact] @@ -57,7 +26,7 @@ public void Execute_ApplyIndividualRuleToFileThree_DoesNotThrowException() Rule = "RuleTest" }; - var command = new ApplyRuleCommand(_brConfiguration, applyRuleParameter, _printMock.Object); + var command = new ApplyRuleCommand(_workspace.BrConfiguration, applyRuleParameter, _printMock.Object); // Act var executionResult = Record.Exception(() => command.ExecuteAsync()); diff --git a/src/ByReplace.Test/Commands/Apply/Rules/ApplyRulesCommandTest.cs b/src/ByReplace.Test/Commands/Apply/Rules/ApplyRulesCommandTest.cs index bd77f01..295b9a6 100644 --- a/src/ByReplace.Test/Commands/Apply/Rules/ApplyRulesCommandTest.cs +++ b/src/ByReplace.Test/Commands/Apply/Rules/ApplyRulesCommandTest.cs @@ -1,57 +1,27 @@ -using ByReplace.Builders; -using ByReplace.Commands.Apply.Rules; -using ByReplace.Models; +using ByReplace.Commands.Apply.Rules; using ByReplace.Printers; -using ByReplace.Test.Common.ConfigMock; -using ByReplace.Test.Common.FolderMock; +using ByReplace.Test.ClassFixture; using Moq; using Xunit; namespace ByReplace.Test.Commands.Apply.Rules; -public class ApplyRulesCommandTEst +public class ApplyRulesCommandTest : IClassFixture { - private readonly PathCompilationSyntax _pathCompilationSyntax; - private readonly BrConfiguration _brConfiguration; + private readonly WorkspaceFixture _workspace; private readonly Mock _printMock; - public ApplyRulesCommandTEst() + public ApplyRulesCommandTest(WorkspaceFixture workspace) { + _workspace = workspace; _printMock = new Mock(); - - var configContent = BrContentFactory - .CreateDefault() - .AddConfig(BrContentFactory.ConfigNoPathDeclaration("obj", ".bin")) - .AddRules(BrContentFactory - .Rule("RuleTest") - .WithExtensions(".cs", ".txt") - .WithSkips("**\\Controllers\\*", "bin\\bin1.txt", "obj\\obj2.txt") - .WithReplacement(BrContentFactory.Replacement("Test", "Test2"))) - .Compile(); - - var rootFolder = FolderSyntax - .FolderDeclaration("RootFolder") - .AddMembers( - FileSyntax.FileDeclaration("RootFile1.cs", "ITest = new Test()"), - FileSyntax.FileDeclaration("RootFile2.cs", "ITest = new Test()")); - _pathCompilationSyntax = PathFactory - .Compile(nameof(ApplyRulesCommandTEst)) - .AddMembers(rootFolder) - .AddBrConfiguration(configContent) - .Create(); - - _brConfiguration = BrConfigurationBuilder - .Create() - .SetPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .SetConfigPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .Build(); } [Fact] public void Execute_ApplyRulesToFileThree_DoesNotThrowException() { // Arrange - var command = new ApplyRulesCommand(_brConfiguration, _printMock.Object); + var command = new ApplyRulesCommand(_workspace.BrConfiguration, _printMock.Object); // Act var executionResult = Record.Exception(() => command.ExecuteAsync(It.IsAny())); diff --git a/src/ByReplace.Test/Commands/Rule/ListRules/ListRulesCommandTest.cs b/src/ByReplace.Test/Commands/Rule/ListRules/ListRulesCommandTest.cs index 3e51f1d..792c4b1 100644 --- a/src/ByReplace.Test/Commands/Rule/ListRules/ListRulesCommandTest.cs +++ b/src/ByReplace.Test/Commands/Rule/ListRules/ListRulesCommandTest.cs @@ -1,60 +1,29 @@ -using ByReplace.Builders; -using ByReplace.Commands.Rule.ListRules; -using ByReplace.Models; +using ByReplace.Commands.Rule.ListRules; using ByReplace.Printers; -using ByReplace.Test.Common.ConfigMock; -using ByReplace.Test.Common.FolderMock; +using ByReplace.Test.ClassFixture; using Moq; using Xunit; namespace ByReplace.Test.Commands.Rule.ListRules; -public class ListRulesCommandTest +public class ListRulesCommandTest : IClassFixture { - private readonly PathCompilationSyntax _pathCompilationSyntax; - private readonly BrConfiguration _brConfiguration; + private readonly WorkspaceFixture _workspace; private readonly Mock _printBoxMock; - public ListRulesCommandTest() + public ListRulesCommandTest(WorkspaceFixture workspace) { + _workspace = workspace; _printBoxMock = new Mock(); - - var configContent = BrContentFactory - .CreateDefault() - .AddConfig(BrContentFactory.ConfigNoPathDeclaration("obj", ".bin")) - .AddRules(BrContentFactory - .Rule("RuleTest") - .WithExtensions(".cs", ".txt") - .WithSkips("**\\Controllers\\*", "bin\\bin1.txt", "obj\\obj2.txt") - .WithReplacement(BrContentFactory.Replacement("Test", "Test2"))) - .Compile(); - - var rootFolder = FolderSyntax - .FolderDeclaration("RootFolder") - .AddMembers( - FileSyntax.FileDeclaration("RootFile1.cs", "ITest = new Test()"), - FileSyntax.FileDeclaration("RootFile2.cs", "ITest = new Test()")); - - _pathCompilationSyntax = PathFactory - .Compile(nameof(ListRulesCommandTest)) - .AddMembers(rootFolder) - .AddBrConfiguration(configContent) - .Create(); - - _brConfiguration = BrConfigurationBuilder - .Create() - .SetPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .SetConfigPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .Build(); } [Fact] public async Task Execute_WhenPrintTheBoxWithTheRules_ShouldValidateIfBoxWasPrintedOnce() { // Arrange - var builder = new RulesBox(_brConfiguration.Rules); + var builder = new RulesBox(_workspace.BrConfiguration.Rules); - var command = new ListRulesCommand(_brConfiguration, _printBoxMock.Object); + var command = new ListRulesCommand(_workspace.BrConfiguration, _printBoxMock.Object); // Act await command.ExecuteAsync(It.IsAny()); diff --git a/src/ByReplace.Test/Commands/Rule/ListRules/RulesBoxTest.cs b/src/ByReplace.Test/Commands/Rule/ListRules/RulesBoxTest.cs index df71894..7dec633 100644 --- a/src/ByReplace.Test/Commands/Rule/ListRules/RulesBoxTest.cs +++ b/src/ByReplace.Test/Commands/Rule/ListRules/RulesBoxTest.cs @@ -1,18 +1,17 @@ -using Xunit; +using ByReplace.Builders; using ByReplace.Commands.Rule.ListRules; -using ByReplace.Builders; using ByReplace.Models; using ByReplace.Printers; using ByReplace.Test.Common.ConfigMock; using ByReplace.Test.Common.FolderMock; using Moq; -using System.Collections.Immutable; +using Xunit; namespace ByReplace.Test.Commands.Rule.ListRules; public class RulesBoxTest { - private readonly PathCompilationSyntax _pathCompilationSyntax; + private readonly WorkspaceSyntax _workspaceSyntax; private readonly BrConfiguration _brConfiguration; private readonly Mock _printMock; @@ -32,11 +31,11 @@ public RulesBoxTest() var rootFolder = FolderSyntax .FolderDeclaration("RootFolder") - .AddMembers( + .AddFiles( FileSyntax.FileDeclaration("RootFile1.cs", "ITest = new Test()"), FileSyntax.FileDeclaration("RootFile2.cs", "ITest = new Test()")); - _pathCompilationSyntax = PathFactory + _workspaceSyntax = WorkspaceFactory .Compile(nameof(RulesBoxTest)) .AddMembers(rootFolder) .AddBrConfiguration(configContent) @@ -44,8 +43,8 @@ public RulesBoxTest() _brConfiguration = BrConfigurationBuilder .Create() - .SetPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .SetConfigPath($"./{_pathCompilationSyntax.InternalIdentifier}") + .SetPath($"./{_workspaceSyntax.Identifier}") + .SetConfigPath($"./{_workspaceSyntax.Identifier}") .Build(); } diff --git a/src/ByReplace.Test/Commands/Rule/OpenRule/OpenRuleCommandTest.cs b/src/ByReplace.Test/Commands/Rule/OpenRule/OpenRuleCommandTest.cs index ecc6380..3c52597 100644 --- a/src/ByReplace.Test/Commands/Rule/OpenRule/OpenRuleCommandTest.cs +++ b/src/ByReplace.Test/Commands/Rule/OpenRule/OpenRuleCommandTest.cs @@ -1,7 +1,7 @@ using ByReplace.Builders; using ByReplace.Commands.Rule.OpenRule; -using ByReplace.Models; using ByReplace.Printers; +using ByReplace.Test.ClassFixture; using ByReplace.Test.Common.ConfigMock; using ByReplace.Test.Common.FolderMock; using Moq; @@ -9,19 +9,21 @@ namespace ByReplace.Test.Commands.Rule.OpenRule; -public class OpenRuleCommandTest +public class OpenRuleCommandTest : IClassFixture { - private readonly PathCompilationSyntax _pathCompilationSyntax; - private readonly BrConfiguration _brConfiguration; + private readonly WorkspaceFixture _workspace; private readonly Mock _printMock; private readonly Mock _printBoxMock; - public OpenRuleCommandTest() + public OpenRuleCommandTest(WorkspaceFixture workspace) { + _workspace = workspace; _printMock = new Mock(); _printBoxMock = new Mock(); - var configContent = BrContentFactory + _workspace.ClearPrevious(); + + workspace.ConfigContent = BrContentFactory .CreateDefault() .AddConfig(BrContentFactory.ConfigNoPathDeclaration("obj", ".bin")) .AddRules( @@ -40,20 +42,20 @@ public OpenRuleCommandTest() var rootFolder = FolderSyntax .FolderDeclaration("RootFolder") - .AddMembers( + .AddFiles( FileSyntax.FileDeclaration("RootFile1.cs", "ITest = new Test()"), FileSyntax.FileDeclaration("RootFile2.cs", "ITest = new Test()")); - _pathCompilationSyntax = PathFactory + workspace.WorkspaceSyntax = WorkspaceFactory .Compile(nameof(OpenRuleCommandTest)) .AddMembers(rootFolder) - .AddBrConfiguration(configContent) + .AddBrConfiguration(workspace.ConfigContent) .Create(); - _brConfiguration = BrConfigurationBuilder - .Create() - .SetPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .SetConfigPath($"./{_pathCompilationSyntax.InternalIdentifier}") + workspace.BrConfiguration = BrConfigurationBuilder + .Create() + .SetPath($"./{workspace.WorkspaceSyntax.Identifier}") + .SetConfigPath($"./{workspace.WorkspaceSyntax.Identifier}") .Build(); } @@ -61,7 +63,7 @@ public OpenRuleCommandTest() public async Task Execute_WhenNotFindTheRuleOnRulesConfiguration_ShouldValidateTheLogThatShowRuleWasNotFind() { // Arrange - var command = new OpenRuleCommand(_brConfiguration, "NotConfiguratedRule", _printMock.Object, _printBoxMock.Object); + var command = new OpenRuleCommand(_workspace.BrConfiguration, "NotConfiguratedRule", _printMock.Object, _printBoxMock.Object); // Act await command.ExecuteAsync(It.IsAny()); @@ -74,9 +76,9 @@ public async Task Execute_WhenNotFindTheRuleOnRulesConfiguration_ShouldValidateT public async Task Execute_WhenFindTheRuleOnRulesConfiguration_ShouldValidateIfThePrintBoxWasCalled() { // Arrange - var expectedRule = _brConfiguration.Rules.Last(); + var expectedRule = _workspace.BrConfiguration.Rules.Last(); var expectedPrintBox = new RuleBox(expectedRule); - var command = new OpenRuleCommand(_brConfiguration, "RuleTwo", _printMock.Object, _printBoxMock.Object); + var command = new OpenRuleCommand(_workspace.BrConfiguration, "RuleTwo", _printMock.Object, _printBoxMock.Object); // Act await command.ExecuteAsync(It.IsAny()); diff --git a/src/ByReplace.Test/Commands/Rule/OpenRule/RuleBoxTest.cs b/src/ByReplace.Test/Commands/Rule/OpenRule/RuleBoxTest.cs index d252350..f900a84 100644 --- a/src/ByReplace.Test/Commands/Rule/OpenRule/RuleBoxTest.cs +++ b/src/ByReplace.Test/Commands/Rule/OpenRule/RuleBoxTest.cs @@ -11,7 +11,7 @@ namespace ByReplace.Test.Commands.Rule.OpenRule; public class RuleBoxTest { - private readonly PathCompilationSyntax _pathCompilationSyntax; + private readonly WorkspaceSyntax _workspaceSyntax; private readonly BrConfiguration _brConfiguration; private readonly Mock _printMock; @@ -36,11 +36,11 @@ public RuleBoxTest() var rootFolder = FolderSyntax .FolderDeclaration("RootFolder") - .AddMembers( + .AddFiles( FileSyntax.FileDeclaration("RootFile1.cs", "ITest = new Test()"), FileSyntax.FileDeclaration("RootFile2.cs", "ITest = new Test()")); - _pathCompilationSyntax = PathFactory + _workspaceSyntax = WorkspaceFactory .Compile(nameof(RuleBoxTest)) .AddMembers(rootFolder) .AddBrConfiguration(configContent) @@ -48,8 +48,8 @@ public RuleBoxTest() _brConfiguration = BrConfigurationBuilder .Create() - .SetPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .SetConfigPath($"./{_pathCompilationSyntax.InternalIdentifier}") + .SetPath($"./{_workspaceSyntax.Identifier}") + .SetConfigPath($"./{_workspaceSyntax.Identifier}") .Build(); } diff --git a/src/ByReplace.Test/Common/FolderMock/FolderSyntax.cs b/src/ByReplace.Test/Common/FolderMock/FolderSyntax.cs index 7b8cc5c..c5c7148 100644 --- a/src/ByReplace.Test/Common/FolderMock/FolderSyntax.cs +++ b/src/ByReplace.Test/Common/FolderMock/FolderSyntax.cs @@ -49,7 +49,7 @@ public FolderSyntax AddMembers(FileSyntax fileSyntax) return this; } - public FolderSyntax AddMembers(params FileSyntax[] filesSyntax) + public FolderSyntax AddFiles(params FileSyntax[] filesSyntax) { this.Files.AddRange(filesSyntax); return this; diff --git a/src/ByReplace.Test/Common/FolderMock/PathFactory.cs b/src/ByReplace.Test/Common/FolderMock/PathFactory.cs deleted file mode 100644 index 39c8349..0000000 --- a/src/ByReplace.Test/Common/FolderMock/PathFactory.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace ByReplace.Test.Common.FolderMock; - -internal sealed class PathFactory -{ - public static PathCompilationSyntax Compile() => new PathCompilationSyntax(); - public static PathCompilationSyntax Compile(string testCase) => new PathCompilationSyntax(testCase); -} diff --git a/src/ByReplace.Test/Common/FolderMock/WorkspaceFactory.cs b/src/ByReplace.Test/Common/FolderMock/WorkspaceFactory.cs new file mode 100644 index 0000000..6771852 --- /dev/null +++ b/src/ByReplace.Test/Common/FolderMock/WorkspaceFactory.cs @@ -0,0 +1,7 @@ +namespace ByReplace.Test.Common.FolderMock; + +internal sealed class WorkspaceFactory +{ + public static WorkspaceSyntax Compile() => new WorkspaceSyntax(); + public static WorkspaceSyntax Compile(string testCase) => new WorkspaceSyntax(testCase); +} diff --git a/src/ByReplace.Test/Common/FolderMock/PathCompilationSyntax.cs b/src/ByReplace.Test/Common/FolderMock/WorkspaceSyntax.cs similarity index 64% rename from src/ByReplace.Test/Common/FolderMock/PathCompilationSyntax.cs rename to src/ByReplace.Test/Common/FolderMock/WorkspaceSyntax.cs index 4e24639..9de2ca7 100644 --- a/src/ByReplace.Test/Common/FolderMock/PathCompilationSyntax.cs +++ b/src/ByReplace.Test/Common/FolderMock/WorkspaceSyntax.cs @@ -3,56 +3,56 @@ using System.Text.Json; namespace ByReplace.Test.Common.FolderMock; -internal sealed class PathCompilationSyntax +internal sealed class WorkspaceSyntax { private readonly List _folders; private ContentSyntax _brConfiguration; - public string InternalIdentifier { get; } + public string Identifier { get; } - public PathCompilationSyntax() + public WorkspaceSyntax() { - InternalIdentifier = Guid.NewGuid().ToString(); + Identifier = Guid.NewGuid().ToString(); _folders = new List(); _brConfiguration = new ContentSyntax(); } - public PathCompilationSyntax(string testCase) + public WorkspaceSyntax(string testCase) { - InternalIdentifier = $"{testCase}_{Guid.NewGuid()}"; + Identifier = $"{testCase}_{Guid.NewGuid()}"; _folders = new List(); _brConfiguration = new ContentSyntax(); } - public PathCompilationSyntax AddMembers(params FolderSyntax[] foldersSyntax) + public WorkspaceSyntax AddMembers(params FolderSyntax[] foldersSyntax) { this._folders.AddRange(foldersSyntax); return this; } - public PathCompilationSyntax AddMember(FolderSyntax folderSyntax) + public WorkspaceSyntax AddMember(FolderSyntax folderSyntax) { _folders.Add(folderSyntax); return this; } - public PathCompilationSyntax AddBrConfiguration(ContentSyntax configSyntax) + public WorkspaceSyntax AddBrConfiguration(ContentSyntax configSyntax) { _brConfiguration = configSyntax; return this; } - public PathCompilationSyntax AddFolder(string name) + public WorkspaceSyntax AddFolder(string name) { _folders.Add(new FolderSyntax(name)); return this; } - public PathCompilationSyntax Create() + public WorkspaceSyntax Create() { foreach (ref var folder in CollectionsMarshal.AsSpan(_folders)) { @@ -66,13 +66,13 @@ public PathCompilationSyntax Create() WriteIndented = true }); - File.WriteAllText($"./{InternalIdentifier}/brconfig.json", brConfig); + File.WriteAllText($"./{Identifier}/brconfig.json", brConfig); } return this; } - public PathCompilationSyntax CreateThreeFolder(FolderSyntax folderSyntax) + public WorkspaceSyntax CreateThreeFolder(FolderSyntax folderSyntax) { if (folderSyntax is null) { @@ -85,8 +85,8 @@ public PathCompilationSyntax CreateThreeFolder(FolderSyntax folderSyntax) } var dirPath = folderSyntax.Parent is not null - ? $"./{InternalIdentifier}/{folderSyntax.Parent.Name}/{folderSyntax.Name}" - : $"./{InternalIdentifier}/{folderSyntax.Name}"; + ? $"./{Identifier}/{folderSyntax.Parent.Name}/{folderSyntax.Name}" + : $"./{Identifier}/{folderSyntax.Name}"; if (!Directory.Exists(dirPath)) { diff --git a/src/ByReplace.Test/Mappers/DirectoryThreeTest.cs b/src/ByReplace.Test/Mappers/DirectoryThreeTest.cs index 8c828a6..c20df6d 100644 --- a/src/ByReplace.Test/Mappers/DirectoryThreeTest.cs +++ b/src/ByReplace.Test/Mappers/DirectoryThreeTest.cs @@ -11,7 +11,7 @@ namespace ByReplace.Test.Mappers; public class DirectoryThreeTest { - private readonly PathCompilationSyntax _pathCompilationSyntax; + private readonly WorkspaceSyntax _workspaceSyntax; private readonly BrConfiguration _brConfiguration; private readonly Mock _printMock; @@ -31,11 +31,11 @@ public DirectoryThreeTest() var rootFolder = FolderSyntax .FolderDeclaration("RootFolder") - .AddMembers( + .AddFiles( FileSyntax.FileDeclaration("RootFile1.cs", "ITest = new Test()"), FileSyntax.FileDeclaration("RootFile2.cs", "ITest = new Test()")); - _pathCompilationSyntax = PathFactory + _workspaceSyntax = WorkspaceFactory .Compile(nameof(DirectoryThreeTest)) .AddMembers(rootFolder) .AddBrConfiguration(configContent) @@ -43,8 +43,8 @@ public DirectoryThreeTest() _brConfiguration = BrConfigurationBuilder .Create() - .SetPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .SetConfigPath($"./{_pathCompilationSyntax.InternalIdentifier}") + .SetPath($"./{_workspaceSyntax.Identifier}") + .SetConfigPath($"./{_workspaceSyntax.Identifier}") .Build(); } diff --git a/src/ByReplace.Test/Models/BrConfigurationTest.cs b/src/ByReplace.Test/Models/BrConfigurationTest.cs index 5f3451e..83c5aca 100644 --- a/src/ByReplace.Test/Models/BrConfigurationTest.cs +++ b/src/ByReplace.Test/Models/BrConfigurationTest.cs @@ -1,16 +1,14 @@ using ByReplace.Builders; using ByReplace.Models; -using ByReplace.Test.Analyzers; using ByReplace.Test.Common.ConfigMock; using ByReplace.Test.Common.FolderMock; -using System.Collections.Immutable; using Xunit; namespace ByReplace.Test.Models; public class BrConfigurationTest { - private readonly PathCompilationSyntax _pathCompilationSyntax; + private readonly WorkspaceSyntax _workspaceSyntax; private readonly BrConfiguration _brConfiguration; public BrConfigurationTest() @@ -27,11 +25,11 @@ public BrConfigurationTest() var rootFolder = FolderSyntax .FolderDeclaration("RootFolder") - .AddMembers( + .AddFiles( FileSyntax.FileDeclaration("RootFile1.cs", "ITest = new Test()"), FileSyntax.FileDeclaration("RootFile2.cs", "ITest = new Test()")); - _pathCompilationSyntax = PathFactory + _workspaceSyntax = WorkspaceFactory .Compile(nameof(BrConfigurationTest)) .AddMembers(rootFolder) .AddBrConfiguration(configContent) @@ -39,8 +37,8 @@ public BrConfigurationTest() _brConfiguration = BrConfigurationBuilder .Create() - .SetPath($"./{_pathCompilationSyntax.InternalIdentifier}") - .SetConfigPath($"./{_pathCompilationSyntax.InternalIdentifier}") + .SetPath($"./{_workspaceSyntax.Identifier}") + .SetConfigPath($"./{_workspaceSyntax.Identifier}") .Build(); } @@ -99,7 +97,7 @@ public void ChangeDefaultPath_WhenChangePathToAPathThatDoesNotExists_ShouldRecei public void GetConfiguration_WhenGetConfigurationThatExistsOnPath_ShouldReturnBrConfiguration() { // Arrange && Act - var config = BrConfiguration.GetConfiguration(_pathCompilationSyntax.InternalIdentifier); + var config = BrConfiguration.GetConfiguration(_workspaceSyntax.Identifier); // Assert Assert.NotNull(config);