Ejemplo n.º 1
0
        private static void Factory()
        {
            _fileSystem         = FileSystem.Default;
            _notificationSystem = new ConsoleNotificationSystem();
            _disk = new DiskConfigurator(_fileSystem, _notificationSystem);
            switch (OS.GetCurrent())
            {
            case "win":
                _path         = new PathsConfigurator(CommandSystem.Win, _fileSystem);
                _bridgeSystem = BridgeSystem.Bat;
                _colorify     = new Format(Theme.Dark);
                break;

            case "mac":
                _path         = new PathsConfigurator(CommandSystem.Mac, _fileSystem);
                _bridgeSystem = BridgeSystem.Bash;
                _colorify     = new Format(Theme.Light);
                break;
            }
            _shell     = new ShellConfigurator(_bridgeSystem, _notificationSystem);
            _logSystem = new FileLogTxt(_fileSystem, _path.Combine("~"), ".hardhat.log");
        }
Ejemplo n.º 2
0
        public void Combine_WhenCalls_ReturnsCombinedPath(string expected, params string[] paths)
        {
            //Arrange
            PathsConfigurator creator = new PathsConfigurator(_commandSystem, _fileSystem);

            string expectedResult = Path.Combine(paths);

            _fileSystemMock
            .Setup(fs => fs.PathCombine(It.IsAny <string[]>()))
            .Returns(expectedResult);
            expectedResult = Path.Combine(_userFolder, expected);
            _commandSystemMock
            .Setup(cs => cs.GetHomeFolder(It.IsAny <string>()))
            .Returns(expectedResult);

            //Act
            var result = creator.Combine(paths);

            //Assert
            Assert.Equal(expectedResult, result);
            _fileSystemMock.VerifyAll();
            _commandSystemMock.VerifyAll();
        }