Ejemplo n.º 1
0
        public void ItGetsNullForMissingRepositoryPath()
        {
            const string repoName         = "TestRepo";
            var          mockedFolderPath = PurePath.Create("/opt");

            var environment = Mock.Of <ISystemEnvironment>(
                e => e.GetFolderPath(It.IsAny <Environment.SpecialFolder>(),
                                     It.IsAny <Environment.SpecialFolderOption>()) == mockedFolderPath.ToString()
                );

            var fileSystem = new MockFileSystem();

            IStampConfig stampConfig = new StampConfig(environment, fileSystem);

            stampConfig.GetRepositoryPath(repoName).Should().BeNull();
        }
Ejemplo n.º 2
0
        public void ItLoadStandardStampConfig()
        {
            var mockedFolderPath = PurePath.Create("/opt");
            var expectedRootPath = mockedFolderPath.Join(StampConfigConstants.ConfigDirectoryName);

            var environment = Mock.Of <ISystemEnvironment>(
                e => e.GetFolderPath(It.IsAny <Environment.SpecialFolder>(),
                                     It.IsAny <Environment.SpecialFolderOption>()) == mockedFolderPath.ToString()
                );

            var fileSystem = new MockFileSystem();

            IStampConfig stampConfig = new StampConfig(environment, fileSystem);

            stampConfig.RootPath.Should().Be(expectedRootPath);
        }
Ejemplo n.º 3
0
        public void ItGetsCreatesMissingRepositoryPath()
        {
            const string repoName         = "TestRepo";
            var          mockedFolderPath = PurePath.Create("/opt");
            var          expectedRepoPath = mockedFolderPath.Join(
                StampConfigConstants.ConfigDirectoryName,
                StampConfigConstants.RepositoriesDirectoryName,
                repoName
                );

            var environment = Mock.Of <ISystemEnvironment>(
                e => e.GetFolderPath(It.IsAny <Environment.SpecialFolder>(),
                                     It.IsAny <Environment.SpecialFolderOption>()) == mockedFolderPath.ToString()
                );

            var fileSystem = new MockFileSystem();

            IStampConfig stampConfig = new StampConfig(environment, fileSystem);

            stampConfig.GetRepositoryPath(repoName, createMissing: true).Should().Be(expectedRepoPath);
        }