diff --git a/tst/CTA.Rules.Test/UtilsTest.cs b/tst/CTA.Rules.Test/UtilsTest.cs index 7f0a5750..ce817b89 100644 --- a/tst/CTA.Rules.Test/UtilsTest.cs +++ b/tst/CTA.Rules.Test/UtilsTest.cs @@ -5,7 +5,10 @@ using System.IO; using System.Linq; using System.Threading.Tasks; +using Codelyzer.Analysis; +using Codelyzer.Analysis.Model; using CTA.Rules.Common.Helpers; +using CTA.Rules.PortCore; namespace CTA.Rules.Test { @@ -121,5 +124,34 @@ public void Test_Is_VisualBasic_Project() Assert.IsTrue(VisualBasicUtils.IsVisualBasicProject("C://user/john/repos/test.vbproj")); Assert.IsFalse(VisualBasicUtils.IsVisualBasicProject("vbprojproject.cs")); } + + [Test] + public void TestLoadReferencesFromProject() + { + var analyzeResult = new AnalyzerResult + { + ProjectResult = new ProjectWorkspace("dummy.csproj") + { + SourceFileResults = new UstList() + { + new RootUstNode() + { + Children = new UstList + { + new ImportsStatement { Identifier = "Newtonsoft.Json"}, + new UsingDirective {Identifier = "BouncyCastle.NetCore"} + }, + References = new UstList() + { + new Reference() {Namespace = "BouncyCastle.NetCore"} + } + } + } + } + }; + + var references = PortCoreUtils.GetReferencesForProject(analyzeResult); + Assert.IsTrue(references.Count == 2); + } } } \ No newline at end of file