public void GetPackagesLockFilePath_PackagesLockJson() { // Arrange var projectName = "testproj"; var logger = new TestLogger(); using (var rootFolder = TestDirectory.Create()) { var projectFolder = new DirectoryInfo(Path.Combine(rootFolder, projectName)); var targetFramework = NuGetFramework.Parse("net46"); var msBuildNuGetProjectSystem = new TestMSBuildNuGetProjectSystem(targetFramework, new TestNuGetProjectContext(), projectFolder.FullName); var project = new TestMSBuildNuGetProject(msBuildNuGetProjectSystem, rootFolder, projectFolder.FullName); // Act var lockFile = PackagesConfigLockFileUtility.GetPackagesLockFilePath(project); // Assert Assert.Equal(Path.Combine(projectFolder.FullName, "packages.lock.json"), lockFile); } }
public void GetPackagesLockFilePath_MsbuildProperty() { // Arrage var projectName = "testproj"; var logger = new TestLogger(); var expected = "somewhere\\my.lock.json"; using (var rootFolder = TestDirectory.Create()) { var projectFolder = new DirectoryInfo(Path.Combine(rootFolder, projectName)); var targetFramework = NuGetFramework.Parse("net46"); var msBuildNuGetProjectSystem = new TestMSBuildNuGetProjectSystem(targetFramework, new TestNuGetProjectContext(), projectFolder.FullName); var project = new TestMSBuildNuGetProject(msBuildNuGetProjectSystem, rootFolder, projectFolder.FullName); msBuildNuGetProjectSystem.SetPropertyValue("NuGetLockFilePath", expected); // Act var lockFile = PackagesConfigLockFileUtility.GetPackagesLockFilePath(project); // Assert Assert.Equal(Path.Combine(projectFolder.FullName, expected), lockFile); } }