コード例 #1
0
        public void SingleDependencyWithCorrespondingPackageGetsNugetted()
        {
            var singleDependency            = ProjectReferenceTestData.ConstructMockDependency();
            var projectWithSingleDependency = ProjectReferenceTestData.ConstructMockProject(new[] { singleDependency.Object });
            var packageRepositoryWithCorrespondingPackage = ProjectReferenceTestData.CreateMockRepository();

            var nugetifier = ReferenceNugetifierTester.BuildNugetifier(vsProject: projectWithSingleDependency, packageRepository: packageRepositoryWithCorrespondingPackage);

            ReferenceNugetifierTester.NugetifyReferencesInProject(nugetifier);
            singleDependency.Verify(binaryDependency => binaryDependency.ConvertToNugetReferenceWithHintPath(It.IsAny <string>()), Times.Once());
        }
コード例 #2
0
        public void SingleDependencyWithoutCorrespondingPackageNotNugetted()
        {
            var singleDependency            = ProjectReferenceTestData.ConstructMockDependency();
            var projectWithSingleDependency = ProjectReferenceTestData.ConstructMockProject(new[] { singleDependency.Object });

            var nugetifier = ReferenceNugetifierTester.BuildNugetifier(vsProject: projectWithSingleDependency);

            ReferenceNugetifierTester.NugetifyReferencesInProject(nugetifier);

            singleDependency.Verify(binaryDependency => binaryDependency.ConvertToNugetReferenceWithHintPath(It.IsAny <string>()), Times.Never());
        }
コード例 #3
0
        public void PackageFoundForDependencyWithNoHintPath()
        {
            var singleDependency                = ProjectReferenceTestData.ConstructMockDependency(hasHintpath: false);
            var projectWithSingleDependency     = ProjectReferenceTestData.ConstructMockProject(new[] { singleDependency.Object });
            var packageRepositoryWithOnePackage = ProjectReferenceTestData.CreateMockRepository();

            var nugetifier           = ReferenceNugetifierTester.BuildNugetifier(vsProject: projectWithSingleDependency, packageRepository: packageRepositoryWithOnePackage);
            var nugettedDependencies = ReferenceNugetifierTester.NugetifyReferencesInProject(nugetifier);

            Assert.That(nugettedDependencies, Is.Not.Empty);
            Assert.That(nugettedDependencies.Single().Id, Contains.Substring(ProjectReferenceTestData.PackageInRepository));
        }
コード例 #4
0
        public void TwoDependenciesWithCorrespondingPackagesGetNugetted()
        {
            var defaultDependency           = ProjectReferenceTestData.ConstructMockDependency(ProjectReferenceTestData.AssemblyFilenameInPackageRepository);
            var secondDependency            = ProjectReferenceTestData.ConstructMockDependency(ProjectReferenceTestData.AnotherAssemblyInPackageRepository);
            var projectWithSingleDependency = ProjectReferenceTestData.ConstructMockProject(new[] { defaultDependency.Object, secondDependency.Object });
            var packageRepositoryWithCorrespondingPackage = ProjectReferenceTestData.CreateMockRepository();

            var nugetifier = ReferenceNugetifierTester.BuildNugetifier(vsProject: projectWithSingleDependency, packageRepository: packageRepositoryWithCorrespondingPackage);

            ReferenceNugetifierTester.NugetifyReferencesInProject(nugetifier);
            defaultDependency.Verify(d => d.ConvertToNugetReferenceWithHintPath(It.IsAny <string>()), Times.Once());
            secondDependency.Verify(d => d.ConvertToNugetReferenceWithHintPath(It.IsAny <string>()), Times.Once());
        }