• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ProjectManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ProjectManager的典型用法代码示例。如果您正苦于以下问题:C# ProjectManager类的具体用法?C# ProjectManager怎么用?C# ProjectManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ProjectManager类属于命名空间,在下文中一共展示了ProjectManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AdjustGroupScheduleOnGroup

        public void AdjustGroupScheduleOnGroup()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var group = new Task();
            var one = new Task();
            manager.Add(group);
            manager.Add(one);

            // setup: set initial task parameters
            manager.SetStart(group, 6);
            manager.SetDuration(group, 5);
            manager.SetStart(one, 9);
            manager.SetEnd(one, 15);
            Assert.IsTrue(group.Start == 6);
            Assert.IsTrue(group.End == 11);
            Assert.IsTrue(one.Start == 9);
            Assert.IsTrue(one.Duration == 6);

            // test: make a group and group make have same parameters as one
            manager.Group(group, one);
            Assert.IsTrue(group.Start == one.Start);
            Assert.IsTrue(group.End == one.End);
            Assert.IsTrue(group.Duration == one.Duration);
            Assert.IsTrue(group.Complete == one.Complete);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:25,代码来源:TaskTest.cs


示例2: AdjustDependantScheduleOnRelate

        public void AdjustDependantScheduleOnRelate()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var one = new Task() { Name = "one" };
            var two = new Task() { Name = "two" };
            manager.Add(one);
            manager.Add(two);

            // setup: make 2 independant tasks
            manager.SetStart(one, 10);
            manager.SetDuration(one, 6);
            manager.SetStart(two, 10);
            manager.SetDuration(two, 10);
            Assert.IsTrue(one.Start == 10);
            Assert.IsTrue(one.End == 16);
            Assert.IsTrue(two.Start == 10);
            Assert.IsTrue(two.End == 20);

            // test: relate one and two; one before two
            manager.Relate(one, two);
            Assert.IsTrue(one.Start == 10);
            Assert.IsTrue(one.End == 16);
            Assert.IsTrue(two.Start == 17);
            Assert.IsTrue(two.End == 27);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:25,代码来源:TaskTest.cs


示例3: ConnectionContext

        public ConnectionContext(Socket acceptedSocket,
            string hostName,
            ProtocolManager protocolManager,
            DesignTimeWorkspace workspaceContext,
            IDictionary<int, ProjectManager> projects)
        {
            _hostName = hostName;
            _projects = projects;

            _queue = new ProcessingQueue(new NetworkStream(acceptedSocket));
            _queue.OnReceive += message =>
            {
                if (protocolManager.IsProtocolNegotiation(message))
                {
                    message.Sender = this;
                    protocolManager.Negotiate(message);
                }
                else
                {
                    message.Sender = this;
                    ProjectManager projectManager;
                    if (!_projects.TryGetValue(message.ContextId, out projectManager))
                    {
                        projectManager = new ProjectManager(message.ContextId,
                                                           workspaceContext,
                                                           protocolManager);

                        _projects[message.ContextId] = projectManager;
                    }

                    projectManager.OnReceive(message);
                }
            };
        }
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:34,代码来源:ConnectionContext.cs


示例4: GetRemotePackagesTest

        public void GetRemotePackagesTest()
        {
            // Arrange
            var siteRoot = "x:\\";
            var localRepository = new MockPackageRepository();
            var sourceRepository = new MockServiceBasePackageRepository();
            var projectSystem = new WebProjectSystem(siteRoot);
            var pathResolver = new DefaultPackagePathResolver(projectSystem);
            var projectManager = new ProjectManager(sourceRepository, pathResolver, projectSystem, localRepository);

            var net40 = new FrameworkName(".NETFramework", new Version("4.0.0.0"));
            var net45 = new FrameworkName(".NETFramework", new Version("4.5.0.0"));

            IPackage packageA = PackageFactory.Create("A", new Version("1.0"), null, new FrameworkName[]{ net40 });
            IPackage packageB = PackageFactory.Create("B", new Version("1.0"), null, new FrameworkName[]{ net45 });
            IPackage packageC = PackageFactory.Create("C", new Version("1.0"));

            sourceRepository.AddPackage(packageA);
            sourceRepository.AddPackage(packageB);
            sourceRepository.AddPackage(packageC);

            // NOTE THAT target framework used by WebProjectManager would be .NETFramework, Version=4.0.0.0
            var webProjectManager = new WebProjectManager(projectManager, siteRoot);

            // Act
            var packages = webProjectManager.GetRemotePackages(null, false).ToList();

            // Assert
            Assert.Equal(2, packages.Count);
            Assert.Equal(packageA, packages[0]);
            Assert.Equal(packageC, packages[1]);
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:32,代码来源:WebProjectManagerTest.cs


示例5: AddPackageReferenceAddingPackageWithDuplicateReferenceOverwritesReference

        public void AddPackageReferenceAddingPackageWithDuplicateReferenceOverwritesReference()
        {
            // Arrange
            var projectSystem = new MockProjectSystem();
            var localRepository = new MockPackageRepository();
            var mockRepository = new MockPackageRepository();
            var projectManager = new ProjectManager(mockRepository, new DefaultPackagePathResolver(projectSystem), projectSystem, localRepository);
            var packageA = PackageUtility.CreatePackage("A", "1.0",
                                                        assemblyReferences: new[] { "reference.dll" });
            var packageB = PackageUtility.CreatePackage("B", "1.0",
                                                        assemblyReferences: new[] { "reference.dll" });

            mockRepository.AddPackage(packageA);
            mockRepository.AddPackage(packageB);

            // Act
            projectManager.AddPackageReference("A");
            projectManager.AddPackageReference("B");

            // Assert
            Assert.AreEqual(0, projectSystem.Paths.Count);
            Assert.AreEqual(1, projectSystem.References.Count);
            Assert.IsTrue(projectSystem.References.ContainsKey(@"reference.dll"));
            Assert.IsTrue(projectSystem.References.ContainsValue(@"B.1.0\reference.dll"));
            Assert.IsTrue(localRepository.Exists("A"));
            Assert.IsTrue(localRepository.Exists("B"));
        }
开发者ID:larsw,项目名称:nuget,代码行数:27,代码来源:ProjectManagerTest.cs


示例6: XdtTransformOnXmlNodeWithAttributes

        public void XdtTransformOnXmlNodeWithAttributes()
        {
            // Arrange
            var mockProjectSystem = new MockProjectSystem();
            var mockRepository = new MockPackageRepository();
            mockProjectSystem.AddFile("test.xml",
@"<a attrib=""b""/>".AsStream());
            var projectManager = new ProjectManager(mockRepository, new DefaultPackagePathResolver(new MockProjectSystem()), mockProjectSystem, new MockPackageRepository());

            var package = new Mock<IPackage>();
            package.Setup(m => m.Id).Returns("A");
            package.Setup(m => m.Version).Returns(new SemanticVersion("1.0"));
            package.Setup(m => m.Listed).Returns(true);

            var file = new Mock<IPackageFile>();
            file.Setup(m => m.Path).Returns(@"content\test.xml.install.xdt");
            file.Setup(m => m.EffectivePath).Returns("test.xml.install.xdt");
            file.Setup(m => m.GetStream()).Returns(() =>
@"<a xmlns:xdt=""http://schemas.microsoft.com/XML-Document-Transform""><test xdt:Transform=""InsertIfMissing""/></a>".AsStream());            

            package.Setup(m => m.GetFiles()).Returns(new[] { file.Object });
            mockRepository.AddPackage(package.Object);

            // Act
            projectManager.AddPackageReference("A");

            // Assert
            Assert.True(mockProjectSystem.FileExists("test.xml"));
            var actual = mockProjectSystem.OpenFile("test.xml").ReadToEnd();
            Assert.Equal("<a attrib=\"b\">\t<test/></a>", actual);
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:31,代码来源:XdtTransformTest.cs


示例7: AddPackageReferenceLoadPackagesProjectNameConfigIfPresent

        public void AddPackageReferenceLoadPackagesProjectNameConfigIfPresent()
        {
            // Arrange            
            var sourceRepository = new MockPackageRepository();
            var projectSystem = new MockProjectSystem(
                new FrameworkName(".NETFramework, Version=4.5"));
            projectSystem.ProjectName = "CoolProject";
            projectSystem.AddFile("packages.CoolProject.config", @"<?xml version=""1.0"" encoding=""utf-8""?>
<packages>
  <package id=""luan"" version=""3.0"" />
</packages>");

            var projectManager = new ProjectManager(sourceRepository, new DefaultPackagePathResolver(projectSystem), projectSystem, new MockPackageRepository());
            IPackage packageA = PackageUtility.CreatePackage(
                "A",
                "1.0",
                assemblyReferences: new[] { "lib\\a.dll"});
            sourceRepository.AddPackage(packageA);

            // Act
            projectManager.AddPackageReference("A");

            // Assert
            Assert.True(projectManager.LocalRepository.Exists("A"));
            Assert.True(projectManager.Project.FileExists("packages.CoolProject.config"));
            Assert.False(projectManager.Project.FileExists("packages.config"));
        }
开发者ID:riteshparekh,项目名称:NuGet,代码行数:27,代码来源:ProjectManagerTest.cs


示例8: InstallPackageSetOperationToInstall3

        public void InstallPackageSetOperationToInstall3()
        {
            // Arrange
            var localRepository = new MockSharedPackageRepository();
            var sourceRepository = new MockPackageRepository();
            var projectSystem = new MockProjectSystem();
            var pathResolver = new DefaultPackagePathResolver(projectSystem);
            var projectManager = new ProjectManager(localRepository, pathResolver, new MockProjectSystem(), new MockPackageRepository());
            var packageManager = new VsPackageManager(TestUtils.GetSolutionManager(), sourceRepository, new Mock<IFileSystemProvider>().Object, projectSystem, localRepository, new Mock<IDeleteOnRestartManager>().Object, new Mock<VsPackageInstallerEvents>().Object);

            var package = PackageUtility.CreatePackage("foo", "1.0", new[] { "hello" });
            sourceRepository.AddPackage(package);

            var package2 = PackageUtility.CreatePackage("bar", "2.0", new[] { "world" });
            sourceRepository.AddPackage(package2);

            // Act
            packageManager.InstallPackage(
                projectManager,
                package2,
                new PackageOperation[] { 
                    new PackageOperation(package, PackageAction.Install),
                    new PackageOperation(package2, PackageAction.Install),
                },
                ignoreDependencies: false, 
                allowPrereleaseVersions: false, 
                logger: NullLogger.Instance);

            // Assert
            Assert.Equal("Install", sourceRepository.LastOperation);
            Assert.Equal("bar", sourceRepository.LastMainPackageId);
            Assert.Equal("2.0", sourceRepository.LastMainPackageVersion);
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:33,代码来源:VsPackageManagerTest.Operation.cs


示例9: AddPackageReferenceAppliesPackageReferencesCorrectly2

        public void AddPackageReferenceAppliesPackageReferencesCorrectly2()
        {
            // Arrange            
            var sourceRepository = new MockPackageRepository();
            var projectSystem = new MockProjectSystem(new FrameworkName(".NETFramework, Version=4.5"));
            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" });
            sourceRepository.AddPackage(packageA);

            Mock<IPackage> mockPackageA = Mock.Get<IPackage>(packageA);
            mockPackageA.Setup(m => m.PackageAssemblyReferences).Returns(
                    new PackageReferenceSet[] { 
                        new PackageReferenceSet(VersionUtility.ParseFrameworkName("net40"), new [] { "a.dll" }),
                        new PackageReferenceSet(VersionUtility.ParseFrameworkName("net45"), new [] { "b.dll" })
                    }
                );

            // Act
            projectManager.AddPackageReference("A");

            // Assert
            Assert.True(projectManager.LocalRepository.Exists("A"));
            Assert.False(projectSystem.ReferenceExists("a.dll"));
            Assert.True(projectSystem.ReferenceExists("b.dll"));
        }
开发者ID:anurse,项目名称:NuGet,代码行数:28,代码来源:ProjectManagerTest.cs


示例10: ItemList

        public ItemList(ProjectManager project, Project buildProject)
        {
            this.project = project;
            this.buildProject = buildProject;
            new ItemNode(this, VSConstants.VSITEMID_ROOT);

        }
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:7,代码来源:ItemList.cs


示例11: AdjustGroupDuringJoin

        public void AdjustGroupDuringJoin()
        {
            IProjectManager<Task, object> manager = new ProjectManager<Task, object>();
            var group = new Task();
            var split = new Task();
            var part1 = new Task();
            var part2 = new Task();
            var part3 = new Task();
            manager.Add(split);
            manager.Add(group);

            // setup: create a split under a group
            manager.Group(group, split);
            manager.Split(split, part1, part2, 1);
            manager.Split(part2, part3, 1);
            Assert.IsTrue(group.Duration == 5);
            Assert.IsTrue(group.Duration == split.Duration);
            Assert.IsTrue(group.End == part3.End);

            // test: join and make sure group duration is shortened
            manager.Join(part1, part3);
            Assert.IsTrue(!manager.IsPart(part3));
            Assert.IsTrue(group.Duration == 4);
            Assert.IsTrue(group.Duration == split.Duration);
            Assert.IsTrue(group.End == part2.End);
        }
开发者ID:JackWangCUMT,项目名称:NetGanttControl,代码行数:26,代码来源:ProjectTest.cs


示例12: AddPackageReferenceWhenNewVersionOfPackageAlreadyReferencedThrows

        public void AddPackageReferenceWhenNewVersionOfPackageAlreadyReferencedThrows()
        {
            // Arrange            
            var sourceRepository = new MockPackageRepository();
            var projectSystem = new MockProjectSystem();
            var projectManager = new ProjectManager(sourceRepository, new DefaultPackagePathResolver(projectSystem), projectSystem, new MockPackageRepository());
            IPackage packageA10 = PackageUtility.CreatePackage("A", "1.0",
                                                                dependencies: new List<PackageDependency> { 
                                                                    new PackageDependency("B")
                                                                }, content: new[] { "foo" });
            IPackage packageA20 = PackageUtility.CreatePackage("A", "2.0",
                                                                dependencies: new List<PackageDependency> { 
                                                                    new PackageDependency("B")
                                                                }, content: new[] { "foo" });
            IPackage packageB10 = PackageUtility.CreatePackage("B", "1.0", content: new[] { "foo" });
            projectManager.LocalRepository.AddPackage(packageA20);
            projectManager.LocalRepository.AddPackage(packageB10);

            sourceRepository.AddPackage(packageA20);
            sourceRepository.AddPackage(packageB10);
            sourceRepository.AddPackage(packageA10);
            sourceRepository.AddPackage(packageA20);
            sourceRepository.AddPackage(packageB10);

            // Act & Assert
            ExceptionAssert.Throws<InvalidOperationException>(() => projectManager.AddPackageReference("A", SemanticVersion.Parse("1.0")), @"Already referencing a newer version of 'A'.");
        }
开发者ID:themotleyfool,项目名称:NuGet,代码行数:27,代码来源:ProjectManagerTest.cs


示例13: UninstallPackageExecutesUninstallScript

        public void UninstallPackageExecutesUninstallScript()
        {
            // Arrange
            var activeRepository = new MockPackageRepository();
            var localRepository = new Mock<MockPackageRepository>() { CallBase = true };
            localRepository.As<ISharedPackageRepository>();
            var projectRepository = new MockProjectPackageRepository(localRepository.Object);
            var project = TestUtils.GetProject("Foo");
            var projectSystem = new MockProjectSystem();
            var projectManager = new ProjectManager(activeRepository, new DefaultPackagePathResolver(new MockFileSystem()), projectSystem, projectRepository);
            var package = PackageUtility.CreatePackage("A");
            var scriptExecutor = new Mock<IScriptExecutor>(MockBehavior.Strict);
            scriptExecutor.Setup(s => s.Execute(@"C:\MockFileSystem\A.1.0", "uninstall.ps1", package, project, NullLogger.Instance)).Returns(true).Verifiable();
            var packageManager = new Mock<VsPackageManager>(TestUtils.GetSolutionManager(), activeRepository, new Mock<IFileSystemProvider>().Object, new MockFileSystem(), localRepository.Object,
                new Mock<IRecentPackageRepository>().Object, new Mock<VsPackageInstallerEvents>().Object) { CallBase = true };
            var packageManagerFactory = new Mock<IVsPackageManagerFactory>();
            packageManagerFactory.Setup(m => m.CreatePackageManager(activeRepository, false, false)).Returns(packageManager.Object);
            packageManager.Setup(m => m.GetProjectManager(project)).Returns(projectManager).Verifiable();
            var packageUninstaller = new VsPackageUninstaller(packageManagerFactory.Object, activeRepository, scriptExecutor.Object);


            // Act
            localRepository.Object.AddPackage(package);
            packageUninstaller.UninstallPackage(project, "A", removeDependencies: true);

            // Assert
            scriptExecutor.Verify();
            Assert.False(localRepository.Object.Contains(package));
        }
开发者ID:xero-github,项目名称:Nuget,代码行数:29,代码来源:VsUninstallerTest.cs


示例14: ResolvePackage

        private IEnumerable<ITaskItem> ResolvePackage(ITaskItem package)
        {
            string id = package.ItemSpec;
            string version = package.GetMetadata("Version");

            Log.LogMessage(MessageImportance.Normal, "Resolving Package Reference {0} {1}...", id, version);

            // Initial version just searches a machine-level repository

            var localFs = new PhysicalFileSystem(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "NuGet", "Lib"));
            var defaultResolver = new DefaultPackagePathResolver(localFs);
            var machineRepo = new LocalPackageRepository(defaultResolver, localFs);
            var buildRepo = new BuildPackageRepository();
            var remoteRepo = new DataServicePackageRepository(new Uri("https://nuget.org/api/v2"));
            var project = new BuildProjectSystem(ProjectDirectory, new FrameworkName(TargetFramework), CurrentReferences);
            var manager = new PackageManager(remoteRepo, defaultResolver, localFs, machineRepo);
            var projectManager = new ProjectManager(remoteRepo, defaultResolver, project, buildRepo);

            // Install the package
            var ver = new SemanticVersion(version);
            manager.PackageInstalling += manager_PackageInstalling;
            manager.InstallPackage(id, ver);
            projectManager.AddPackageReference(id, ver);

            return project.OutputReferences.Select(item =>
            {
                var name = AssemblyName.GetAssemblyName(item);
                return new TaskItem(name.FullName, new Dictionary<string, string>() {
                    {"HintPath", item },
                    {"Private", "true"}
                });
            });
        }
开发者ID:anurse,项目名称:NuGetBuild,代码行数:33,代码来源:ResolvePackageReference.cs


示例15: Form1

        public Form1()
        {
            InitializeComponent();
            // create a project manager
            var manager = new ProjectManager();
            // create built-in task or use your own derived task
            var task = new Braincase.GanttChart.Task() { Name = "Hello "};
            var task1 = new Braincase.GanttChart.Task() { Name = " World" };
            var task2 = new Braincase.GanttChart.Task() { Name = "Helly" };
            var task3 = new Braincase.GanttChart.Task() { Name = "Hel7875" };
            var task5 = new Braincase.GanttChart.Task() { Name = "gmmail" };


            // add the task to the manager
            manager.Add(task2);
            manager.Add(task);
            manager.Add(task1);

            manager.Add(task3);
            manager.Split(task2,task1,2);

            
            //manager.SetDuration(task, 3);
            
            // create a chart control
            var chart = new Chart();
            // initialise the chart with the manager
            chart.Init(manager);
            // add chart to the form controls collection.
            this.Controls.Add(chart);
            
            // throughout your own code, call chart.Invalidate()
            // where you expect updates to the drawn chart,
            // to tell the chart to Paint() itself.
        }
开发者ID:bilale,项目名称:TestVisualStudioGitHub,代码行数:35,代码来源:Form1.cs


示例16: InstallMetadataPackageWithReadMeInstallsIntoProjectAndPackageManager

        public void InstallMetadataPackageWithReadMeInstallsIntoProjectAndPackageManager()
        {
            // Arrange
            var localRepository = new Mock<MockPackageRepository>() { CallBase = true }.As<ISharedPackageRepository>().Object;
            var sourceRepository = new MockPackageRepository();
            var projectSystem = new MockProjectSystem();
            var pathResolver = new DefaultPackagePathResolver(projectSystem);
            var projectManager = new ProjectManager(localRepository, pathResolver, new MockProjectSystem(), new MockPackageRepository());
            var packageManager = new VsPackageManager(TestUtils.GetSolutionManager(), sourceRepository, new Mock<IFileSystemProvider>().Object, projectSystem, localRepository, new Mock<IDeleteOnRestartManager>().Object, new Mock<VsPackageInstallerEvents>().Object);

            var packageA = PackageUtility.CreatePackage("A", "1.0", dependencies: new[] { new PackageDependency("B") });
            var mockPackageA = Mock.Get(packageA);
            mockPackageA.Setup(m => m.GetFiles()).Returns(PackageUtility.CreateFiles(new[] { "readme.txt" }));

            var packageB = PackageUtility.CreatePackage("B", "1.0", content: new[] { "hello.txt" });
            sourceRepository.AddPackage(packageA);
            sourceRepository.AddPackage(packageB);

            // Act
            packageManager.InstallPackage(projectManager, "A", new SemanticVersion("1.0"), ignoreDependencies: false, allowPrereleaseVersions: false, logger: NullLogger.Instance);

            // Assert
            Assert.True(packageManager.LocalRepository.Exists(packageA));
            Assert.True(projectManager.LocalRepository.Exists(packageA));

            Assert.True(packageManager.LocalRepository.Exists(packageB));
            Assert.True(projectManager.LocalRepository.Exists(packageB));
        }
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:28,代码来源:VsPackageManagerTest.cs


示例17: InstallPackageWithOperationsExecuteAllOperations

        public void InstallPackageWithOperationsExecuteAllOperations()
        {
            // Arrange
            var localRepository = new Mock<MockPackageRepository>() { CallBase = true }.As<ISharedPackageRepository>().Object;
            var sourceRepository = new MockPackageRepository();
            var projectSystem = new MockProjectSystem();
            var pathResolver = new DefaultPackagePathResolver(projectSystem);
            var projectManager = new ProjectManager(localRepository, pathResolver, new MockProjectSystem(), new MockPackageRepository());
            var packageManager = new VsPackageManager(TestUtils.GetSolutionManager(), sourceRepository, projectSystem, localRepository, new Mock<IRecentPackageRepository>().Object);

            var package = PackageUtility.CreatePackage("foo", "1.0", new[] { "hello" }, dependencies: new PackageDependency[] { new PackageDependency("bar") });
            sourceRepository.AddPackage(package);

            var package2 = PackageUtility.CreatePackage("bar", "2.0", new[] { "world" });
            sourceRepository.AddPackage(package2);

            var package3 = PackageUtility.CreatePackage("awesome", "1.0", new[] { "candy" });
            localRepository.AddPackage(package3);

            var operations = new PackageOperation[] {
                 new PackageOperation(package, PackageAction.Install),
                 new PackageOperation(package2, PackageAction.Install),
                 new PackageOperation(package3, PackageAction.Uninstall)
             };

            // Act
            packageManager.InstallPackage(projectManager, package, operations, ignoreDependencies: false, logger: NullLogger.Instance);

            // Assert
            Assert.IsTrue(packageManager.LocalRepository.Exists(package));
            Assert.IsTrue(packageManager.LocalRepository.Exists(package2));
            Assert.IsTrue(!packageManager.LocalRepository.Exists(package3));
            Assert.IsTrue(projectManager.LocalRepository.Exists(package));
            Assert.IsTrue(projectManager.LocalRepository.Exists(package2));
        }
开发者ID:jacksonh,项目名称:nuget,代码行数:35,代码来源:VsPackageManagerTest.cs


示例18: InstallPackageRunsInitAndInstallScripts

        public void InstallPackageRunsInitAndInstallScripts()
        {
            // Arrange
            var localRepository = new Mock<MockPackageRepository>() { CallBase = true }.As<ISharedPackageRepository>().Object;
            var sourceRepository = new MockPackageRepository();
            var projectRepository = new MockProjectPackageRepository(localRepository);
            var fileSystem = new MockFileSystem();
            var projectSystem = new MockProjectSystem();
            var pathResolver = new DefaultPackagePathResolver(new MockProjectSystem());
            var project = TestUtils.GetProject("Foo");
            var projectManager = new ProjectManager(localRepository, pathResolver, projectSystem, projectRepository);
            var scriptExecutor = new Mock<IScriptExecutor>();
            var packageManager = new Mock<VsPackageManager>(TestUtils.GetSolutionManager(), sourceRepository, new Mock<IFileSystemProvider>().Object, fileSystem, localRepository, new Mock<IRecentPackageRepository>().Object, 
                new Mock<VsPackageInstallerEvents>().Object) { CallBase = true };
            var packageManagerFactory = new Mock<IVsPackageManagerFactory>();
            packageManagerFactory.Setup(m => m.CreatePackageManager(It.IsAny<IPackageRepository>(), false, false)).Returns(packageManager.Object);
            packageManager.Setup(m => m.GetProjectManager(project)).Returns(projectManager);

            var package = NuGet.Test.PackageUtility.CreatePackage("foo", "1.0", new[] { "hello" }, tools: new[] { "init.ps1", "install.ps1" });
            sourceRepository.AddPackage(package);
            var installer = new VsPackageInstaller(packageManagerFactory.Object, scriptExecutor.Object, new Mock<IPackageRepositoryFactory>().Object, new Mock<IVsCommonOperations>().Object, new Mock<ISolutionManager>().Object);

            // Act
            installer.InstallPackage(sourceRepository, project, "foo", new SemanticVersion("1.0"), ignoreDependencies: false, skipAssemblyReferences: false);

            // Assert
            scriptExecutor.Verify(e => e.Execute(It.IsAny<string>(), PowerShellScripts.Init, It.IsAny<IPackage>(), It.IsAny<Project>(), It.IsAny<ILogger>()), Times.Once());
            scriptExecutor.Verify(e => e.Execute(It.IsAny<string>(), PowerShellScripts.Install, It.IsAny<IPackage>(), It.IsAny<Project>(), It.IsAny<ILogger>()), Times.Once());
        }
开发者ID:xero-github,项目名称:Nuget,代码行数:29,代码来源:VsInstallerTest.cs


示例19: ReinstallPackagesRestoresPackageWithTheSameVersion

        public void ReinstallPackagesRestoresPackageWithTheSameVersion()
        {
            // Arrange
            var localRepository = new Mock<MockPackageRepository>() { CallBase = true }.As<ISharedPackageRepository>().Object;
            var sourceRepository = new MockPackageRepository();
            var projectSystem = new MockProjectSystem();
            var pathResolver = new DefaultPackagePathResolver(projectSystem);
            var projectManager = new ProjectManager(localRepository, pathResolver, projectSystem, new MockPackageRepository());

            var packageManager = new VsPackageManager(
                TestUtils.GetSolutionManager(),
                sourceRepository,
                new Mock<IFileSystemProvider>().Object,
                projectSystem,
                localRepository,
                new Mock<IDeleteOnRestartManager>().Object,
                new Mock<VsPackageInstallerEvents>().Object);

            var packageA = PackageUtility.CreatePackage("A", "1.2", new[] { "content.txt" });
            sourceRepository.Add(packageA);
            localRepository.AddPackage(packageA);
            projectManager.LocalRepository.AddPackage(packageA);

            // Act
            packageManager.ReinstallPackage(projectManager, "A", updateDependencies: true, allowPrereleaseVersions: true, logger: null);

            // Assert
            Assert.True(packageManager.LocalRepository.Exists("A", new SemanticVersion("1.2")));
            Assert.True(projectManager.LocalRepository.Exists("A", new SemanticVersion("1.2")));
        }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:30,代码来源:VsPackageManagerTest.Reinstall.cs


示例20: Write

		public static void Write(ProjectManager projects, string path, IdTable ids) {
			foreach ( var p in projects ) {
				if ( p == Project.Empty ) continue;
				var f = new XmlWriter(path + p.Name + ".xml");
				f.Begin(p, ids);
				f.Begin("Assignments");
				var faclist = new FlatAssignmentCollection[p.Assignments.Count];
				lock ( p.Assignments ) p.Assignments.CopyTo(faclist, 0);
				foreach ( var fac in faclist ) {
					f.Begin(fac, ids);
					var falist = new FlatAssignment[fac.Count];
					lock ( fac ) fac.CopyTo(falist, 0);
					foreach ( var fa in falist ) f.Write(fa, ids);
					f.End(fac);
				}
				f.End("Assignments");
				f.Begin("Costs");
				var costlist = new Cost[p.Costs.Count];
				lock ( p.Costs ) p.Costs.CopyTo(costlist, 0);
				foreach ( var c in costlist ) {
					f.Begin(c, ids);
					f.Begin("Options");
					var optionslist = new CostOptions[c.Options.Count];
					lock ( c.Options ) c.Options.CopyTo(optionslist, 0);
					foreach ( var o in optionslist ) f.Write(o, ids);
					f.End("Options");
					f.End(c);
				}
				f.End("Costs");
				f.End(p);
				f.Close();
			}
		}
开发者ID:Wolfury,项目名称:nebenkosten,代码行数:33,代码来源:Xml.cs



注:本文中的ProjectManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ProjectModelElementEnvoy类代码示例发布时间:2022-05-24
下一篇:
C# ProjectItems类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap