Example #1
0
        public void Execute_Force_CallsClearCache()
        {
            _cacheManager.Setup(x => x.ClearCache()).Verifiable();

            var target = new ClearCommand(_cacheManager.Object, new[] {"-f"});
            target.Execute();

            _cacheManager.Verify();
        }
Example #2
0
        public void Execute_DryRun_DoesNotClearCache()
        {
            // mock is strict, so calling ClearCache will throw
            _cacheManager.Setup(x => x.ListFiles()).Returns(new GitBinFileInfo[0]);

            var target = new ClearCommand(_cacheManager.Object, new[] { "-n" });
            target.Execute();

            Assert.Pass();
        }
Example #3
0
        public void GetCommand_ClearCommandArgument_ReturnsClearCommand()
        {
            var clearCommand = new ClearCommand(null, new []{"-n"});
            Func<string[], ClearCommand> factory = x => clearCommand;

            var target = new CommandFactory(null, null, null, null, null, null, null, factory);
            var command = target.GetCommand(new[] { CommandFactory.ClearArgument });

            Assert.AreSame(clearCommand, command);
        }