GetInstalledPackages() 공개 메소드

public GetInstalledPackages ( ) : IEnumerable
리턴 IEnumerable
        public void GetInstalledPackages_ListContainsUnsortedPackages_ResultIsSorted()
        {
            // Arrange
            var applicationInformation = new ApplicationInformation { ConfigurationFileFolder = Environment.CurrentDirectory };
            var packageInfoFilesystemPersistence = new Mock<IFilesystemPersistence<PackageInfo[]>>();

            var packages = new[]
                {
                    new PackageInfo { Id = "Z", Version = "1.0.0.0" },
                    new PackageInfo { Id = "J", Version = "1.0.0.0" },
                    new PackageInfo { Id = "G", Version = "1.0.0.0" },
                    new PackageInfo { Id = "C", Version = "1.0.0.0" },
                    new PackageInfo { Id = "B", Version = "1.0.0.0" },
                    new PackageInfo { Id = "A", Version = "1.0.0.0" }
                };
            packageInfoFilesystemPersistence.Setup(p => p.Load(It.IsAny<string>())).Returns(packages);

            var packageConfigurationAccessor = new PackageConfigurationAccessor(applicationInformation, packageInfoFilesystemPersistence.Object);

            // Act
            var result = packageConfigurationAccessor.GetInstalledPackages();

            // Assert
            Assert.AreEqual("A", result.First().Id);
            Assert.AreEqual("Z", result.Last().Id);
        }
        public void GetInstalledPackages_ListIsEmpty_ResultIsEmptyList()
        {
            // Arrange
            var applicationInformation = new ApplicationInformation { ConfigurationFileFolder = Environment.CurrentDirectory };
            var packageInfoFilesystemPersistence = new Mock<IFilesystemPersistence<PackageInfo[]>>();

            PackageInfo[] packages = null;
            packageInfoFilesystemPersistence.Setup(p => p.Load(It.IsAny<string>())).Returns(packages);

            var packageConfigurationAccessor = new PackageConfigurationAccessor(applicationInformation, packageInfoFilesystemPersistence.Object);

            // Act
            var result = packageConfigurationAccessor.GetInstalledPackages();

            // Assert
            Assert.AreEqual(0, result.Count());
        }
        public void GetInstalledPackages_ListContainsTwoIdenticalPackages_ResultContainsOnlyOneEntry()
        {
            // Arrange
            var applicationInformation = new ApplicationInformation { ConfigurationFileFolder = Environment.CurrentDirectory };
            var packageInfoFilesystemPersistence = new Mock<IFilesystemPersistence<PackageInfo[]>>();

            var packages = new[]
                {
                    new PackageInfo { Id = "Package.A", Version = "1.0.0.0" },
                    new PackageInfo { Id = "Package.A", Version = "1.0.0.0" }
                };
            packageInfoFilesystemPersistence.Setup(p => p.Load(It.IsAny<string>())).Returns(packages);

            var packageConfigurationAccessor = new PackageConfigurationAccessor(applicationInformation, packageInfoFilesystemPersistence.Object);

            // Act
            var result = packageConfigurationAccessor.GetInstalledPackages();

            // Assert
            Assert.AreEqual(1, result.Count());
        }