< Summary

Class:Mklinker.CommandExecutor
Assembly:Mklinker
File(s):/home/travis/build/rubenchristoffer/Mklinker/Mklinker/CommandExecutor.cs
Covered lines:14
Uncovered lines:10
Coverable lines:24
Total lines:49
Line coverage:58.3% (14 of 24)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity NPath complexity Sequence coverage Branch coverage
.ctor(...)10100%100%
Mklinker.Abstractions.ICommandExecutor.Execute(...)1033.33%100%

File(s)

/home/travis/build/rubenchristoffer/Mklinker/Mklinker/CommandExecutor.cs

#LineLine coverage
 1using System;
 2using System.IO.Abstractions;
 3using CommandLine;
 4using Mklinker.Abstractions;
 5using Mklinker.Commands;
 6
 7namespace Mklinker {
 8
 9  class CommandExecutor : ICommandExecutor {
 10
 11    readonly IConsole console;
 12    readonly IConfigHandler configHandler;
 13    readonly IFileSystem fileSystem;
 14    readonly IConfig defaultConfig;
 15    readonly IArgumentParser argumentHandler;
 16    readonly ILinker linker;
 17    readonly IPathResolver pathResolver;
 18
 619    public CommandExecutor (IConsole console, IConfigHandler configHandler, IFileSystem fileSystem, IConfig defaultConfi
 320      this.console = console;
 321      this.configHandler = configHandler;
 322      this.fileSystem = fileSystem;
 323      this.defaultConfig = defaultConfig;
 324      this.argumentHandler = argumentHandler;
 325      this.linker = linker;
 326      this.pathResolver = pathResolver;
 327    }
 28
 329    void ICommandExecutor.Execute(params string[] args) {
 30      // Parse commands
 631      var parser = new Parser(with => with.HelpWriter = console.Writer);
 332      var parserResult = parser.ParseArguments<AddLinkCommand, AddLinksCommand, AddVariableCommand, RemoveLinkCommand, R
 33
 334      parserResult
 035        .WithParsed<IDefaultCommandHandler>(flag => flag.Execute(console, configHandler, fileSystem))
 036        .WithParsed<ConfigCommand>(cmd => cmd.Execute(console, configHandler, defaultConfig, pathResolver))
 037        .WithParsed<InteractiveCommand>(cmd => cmd.Execute (console, argumentHandler, this))
 038        .WithParsed<LinkAllCommand>(cmd => cmd.Execute (console, configHandler, fileSystem, linker, pathResolver))
 039        .WithParsed<AddLinkCommand>(cmd => cmd.Execute (console, configHandler, fileSystem, pathResolver))
 040        .WithParsed<ValidateCommand>(cmd => cmd.Execute(console, configHandler, fileSystem, pathResolver))
 041        .WithParsed<ListCommand>(cmd => cmd.Execute (console, configHandler, fileSystem, pathResolver))
 042        .WithParsed<AddLinksCommand>(cmd => cmd.Execute(console, configHandler, fileSystem, pathResolver))
 043        .WithParsed<ScanCommand>(cmd => cmd.Execute (console, fileSystem, pathResolver))
 044        .WithParsed<RemoveLinkCommand>(cmd => cmd.Execute(console, configHandler, fileSystem, pathResolver));
 345    }
 46
 47  }
 48
 49}