public void AuthorsIsFlattenedAuthors()
        {
            var authors = new HashSet <PackageAuthor>();
            var author1 = new PackageAuthor
            {
                Name = "author1"
            };
            var author2 = new PackageAuthor
            {
                Name = "author2"
            };

            authors.Add(author1);
            authors.Add(author2);

            var flattenedAuthors = "something Completely different";

            var package = new Package()
            {
                Version             = "1.0.0",
                PackageRegistration = new PackageRegistration {
                    Id = "SomeId"
                },
#pragma warning disable 0618
                Authors = authors,
#pragma warning restore 0618
                FlattenedAuthors = flattenedAuthors
            };

            var listPackageItemViewModel = CreateListPackageItemViewModel(package);

            Assert.Equal(flattenedAuthors, listPackageItemViewModel.Authors);
        }
Beispiel #2
0
        public void AuthorsIsFlattenedAuthors()
        {
            var authors = new HashSet <PackageAuthor>();
            var author1 = new PackageAuthor
            {
                Name = "author1"
            };
            var author2 = new PackageAuthor
            {
                Name = "author2"
            };

            authors.Add(author1);
            authors.Add(author2);

            var flattenedAuthors = "something Completely different";

            var package = new Package()
            {
                Authors          = authors,
                FlattenedAuthors = flattenedAuthors
            };

            var listPackageItemViewModel = new ListPackageItemViewModel(package);

            Assert.Equal(flattenedAuthors, listPackageItemViewModel.Authors);
        }
Beispiel #3
0
        public static Package CreateTestPackage(string id = null)
        {
            var packageRegistration = new PackageRegistration();

            packageRegistration.Id = string.IsNullOrEmpty(id) ? "test" : id;

            var framework = new PackageFramework();
            var author    = new PackageAuthor {
                Name = "maarten"
            };
            var dependency = new PackageDependency {
                Id = "other", VersionSpec = "1.0.0"
            };

            var package = new Package
            {
                Key = 123,
                PackageRegistration = packageRegistration,
                Version             = "1.0.0",
                Hash = _packageHashForTests,
                SupportedFrameworks = new List <PackageFramework>
                {
                    framework
                },
                FlattenedAuthors = "maarten",
#pragma warning disable 0618
                Authors = new List <PackageAuthor>
                {
                    author
                },
#pragma warning restore 0618
                Dependencies = new List <PackageDependency>
                {
                    dependency
                },
                User = new User("test")
            };

            packageRegistration.Packages.Add(package);

            return(package);
        }