Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigusu-Allehu committed Oct 2, 2024
1 parent 4bf5eef commit 4220636
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ public void AddPackageReferenceIntoProjectFileWhenItemGroupDoesExist_Success()
</Project>";
File.WriteAllText(Path.Combine(testDirectory, "projectA.csproj"), projectContent);
var project = Project.FromFile(Path.Combine(testDirectory, "projectA.csproj"), projectOptions);

var msObject = new MSBuildAPIUtility(logger: new TestLogger());
var logger = new TestLogger();
var msObject = new MSBuildAPIUtility(logger: logger);
// Getting all the item groups in a given project
var itemGroups = msObject.GetItemGroups(project);
// Getting an existing item group that has package reference(s)
Expand All @@ -183,6 +183,7 @@ public void AddPackageReferenceIntoProjectFileWhenItemGroupDoesExist_Success()
string updatedProjectFile = File.ReadAllText(Path.Combine(testDirectory, "projectA.csproj"));
Assert.Contains(@$"<PackageReference Include=""X"" />", updatedProjectFile);
Assert.DoesNotContain(@$"<Version = ""1.0.0"" />", updatedProjectFile);
Assert.Contains(string.Format(Strings.Info_AddPkgCPM, "X", project.FullPath, project.GetPropertyValue("DirectoryPackagesPropsPath")), logger.InformationMessages);
}

[PlatformFact(Platform.Windows)]
Expand Down

0 comments on commit 4220636

Please sign in to comment.