public AddReference ( string referencePath ) : void | ||
referencePath | string | |
Résultat | void |
public void RemovingPackageRemoveAssembliesCorrectlyAccordingToReferences3() { // Arrange var sourceRepository = new MockPackageRepository(); var projectSystem = new MockProjectSystem(new FrameworkName(".NETFramework, Version=4.5")); projectSystem.AddReference("a.dll"); projectSystem.AddReference("b.dll"); projectSystem.AddReference("c.dll"); var projectManager = new ProjectManager(sourceRepository, new DefaultPackagePathResolver(projectSystem), projectSystem, new MockPackageRepository()); IPackage packageA = PackageUtility.CreatePackage( "A", "1.0", assemblyReferences: new[] { "lib\\net35\\a.dll", "lib\\net35\\b.dll" }); Mock<IPackage> mockPackageA = Mock.Get<IPackage>(packageA); mockPackageA.Setup(m => m.PackageAssemblyReferences).Returns( new PackageReferenceSet[] { new PackageReferenceSet(VersionUtility.ParseFrameworkName("net50"), new [] { "a.dll" }), new PackageReferenceSet(null, new [] { "b.dll" }) } ); projectManager.LocalRepository.AddPackage(packageA); sourceRepository.AddPackage(packageA); // Act projectManager.RemovePackageReference("A"); // Assert Assert.False(projectManager.LocalRepository.Exists(packageA)); Assert.True(projectSystem.ReferenceExists("a.dll")); Assert.False(projectSystem.ReferenceExists("b.dll")); Assert.True(projectSystem.ReferenceExists("c.dll")); }