GetPublishConfigurations() 공개 메소드

public GetPublishConfigurations ( ) : IEnumerable
리턴 IEnumerable
        public void GetPublishConfigurations_PublishConfigurationPersistenceReturnsNull_ResultIsEmptyList()
        {
            // Arrange
            var applicationInformation = new ApplicationInformation { ConfigurationFileFolder = Environment.CurrentDirectory };
            var publishConfigurationFactory = new Mock<IPublishConfigurationFactory>();
            var publishConfigurationPersistence = new Mock<IFilesystemPersistence<PublishConfiguration[]>>();

            PublishConfiguration[] persitedConfigurations = null;
            publishConfigurationPersistence.Setup(p => p.Load(It.IsAny<string>())).Returns(persitedConfigurations);

            var configFilePublishConfigurationAccessor = new ConfigFilePublishConfigurationAccessor(
                applicationInformation, publishConfigurationFactory.Object, publishConfigurationPersistence.Object);

            // Act
            var result = configFilePublishConfigurationAccessor.GetPublishConfigurations().ToList();

            // Assert
            Assert.AreEqual(0, result.Count);
        }
        public void GetPublishConfigurations_PublishConfigurationPersistenceContainsEntries_AllEntriesAreReturned()
        {
            // Arrange
            var applicationInformation = new ApplicationInformation { ConfigurationFileFolder = Environment.CurrentDirectory };
            var publishConfigurationFactory = new Mock<IPublishConfigurationFactory>();
            var publishConfigurationPersistence = new Mock<IFilesystemPersistence<PublishConfiguration[]>>();

            var persitedConfigurations = new[]
                {
                    new PublishConfiguration { Name = "Some Name 1", PublishLocation = "http://some-nuget-server-1.com/api/v2" },
                    new PublishConfiguration { Name = "Some Name 2", PublishLocation = "http://some-nuget-server-2.com/api/v2" },
                    new PublishConfiguration { Name = "Some Name 3", PublishLocation = "http://some-nuget-server-3.com/api/v2" }
                };

            publishConfigurationPersistence.Setup(p => p.Load(It.IsAny<string>())).Returns(persitedConfigurations);

            var configFilePublishConfigurationAccessor = new ConfigFilePublishConfigurationAccessor(
                applicationInformation, publishConfigurationFactory.Object, publishConfigurationPersistence.Object);

            // Act
            var result = configFilePublishConfigurationAccessor.GetPublishConfigurations().ToList();

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