コード例 #1
0
        public void SinglePackageShouldBePopulated()
        {
            var reader   = MakeReader();
            var packages = reader.Read(StreamFromString(PackagesFileWithSinglePackage), TempPath());

            var package = packages.FirstOrDefault();

            PackageAssert.IsPopulated(package);
        }
コード例 #2
0
        public void WhenOnePackageCannotBeRead_TheOthersAreStillRead()
        {
            var badVersion = PackagesFileWithTwoPackages.Replace("1.2.3.4", "notaversion");

            var reader   = MakeReader();
            var packages = reader.Read(StreamFromString(badVersion), TempPath())
                           .ToList();

            Assert.That(packages.Count, Is.EqualTo(1));
            PackageAssert.IsPopulated(packages[0]);
        }
コード例 #3
0
        public void TwoPackagesShouldBePopulated()
        {
            var reader   = MakeReader();
            var packages = reader.Read(StreamFromString(PackagesFileWithTwoPackages), TempPath())
                           .ToList();

            Assert.That(packages, Is.Not.Null);
            Assert.That(packages.Count, Is.EqualTo(2));

            PackageAssert.IsPopulated(packages[0]);
            PackageAssert.IsPopulated(packages[1]);
        }
コード例 #4
0
        public void SinglePackageIsPopulated()
        {
            const string packagesText = @"<PackageReference Include=""foo"" Version=""1.2.3""></PackageReference>";

            var projectFile = Vs2017ProjectFileTemplateWithPackages.Replace("{{Packages}}", packagesText);

            var reader   = MakeReader();
            var packages = reader.Read(StreamFromString(projectFile), SampleDirectory, SampleFile);

            var package = packages.FirstOrDefault();

            PackageAssert.IsPopulated(package);
        }
コード例 #5
0
        public void ResultIsReiterable()
        {
            var path = TempPath();

            var reader   = MakeReader();
            var packages = reader.Read(StreamFromString(PackagesFileWithTwoPackages), path);

            foreach (var package in packages)
            {
                PackageAssert.IsPopulated(package);
            }

            Assert.That(packages.Select(p => p.Path), Is.All.EqualTo(path));
        }
コード例 #6
0
        public void WhenOnePackageCannotBeRead_TheOthersAreStillRead()
        {
            const string packagesText =
                @"<PackageReference Include=""foo"" Version=""notaversion""></PackageReference>
                  <PackageReference Include=""bar"" Version=""2.3.4""></PackageReference>";

            var projectFile = Vs2017ProjectFileTemplateWithPackages.Replace("{{Packages}}", packagesText);

            var reader   = MakeReader();
            var packages = reader.Read(StreamFromString(projectFile), SampleDirectory, SampleFile)
                           .ToList();

            Assert.That(packages.Count, Is.EqualTo(1));
            PackageAssert.IsPopulated(packages[0]);
        }
コード例 #7
0
        public void WhenTwoPackagesAreRead_TheyArePopulated()
        {
            const string packagesText =
                @"<PackageReference Include=""foo"" Version=""1.2.3""></PackageReference>
                  <PackageReference Include=""bar"" Version=""2.3.4""></PackageReference>";

            var projectFile = Vs2017ProjectFileTemplateWithPackages.Replace("{{Packages}}", packagesText);

            var reader   = MakeReader();
            var packages = reader.Read(StreamFromString(projectFile), SampleDirectory, SampleFile)
                           .ToList();

            Assert.That(packages, Is.Not.Null);
            Assert.That(packages.Count, Is.EqualTo(2));
            PackageAssert.IsPopulated(packages[0]);
            PackageAssert.IsPopulated(packages[1]);
        }