public async Task GetCurrentEntryAsync_NetshReturnsUnknownResult_ReturnsUnknownResult()
        {
            processRunner.RunAsync(
                Arg.Is(NetshCommandFactory.Executable),
                Arg.Is(NetshCommandFactory.GetShowCommandArguments())).Returns("127.0.0.1 80 192.168.42.42 80");
            var tempController = new PortProxyController(settings, processRunner);
            await tempController.RefreshCurrentConnectAddressAsync().ConfigureAwait(false);

            var currentEntry = await tempController.GetCurrentEntryAsync().ConfigureAwait(false);

            Assert.That(currentEntry, Is.Not.Null);
            Assert.That(currentEntry.Name, Is.EqualTo("<unknown>"));
        }
        public async Task GetCurrentEntryAsync_NetshReturnsKnownResultWithPort8080_ReturnsEntry()
        {
            settings.Entries.Returns(
                new List <CommandEntry> {
                new CommandEntry {
                    Name = "MyEntry", Address = "192.168.42.42:8080"
                }
            });
            processRunner.RunAsync(
                Arg.Is(NetshCommandFactory.Executable),
                Arg.Is(NetshCommandFactory.GetShowCommandArguments())).Returns("127.0.0.1 80 192.168.42.42 8080");
            IPortProxyControllerAsync tempController = new PortProxyController(settings, processRunner);
            await tempController.RefreshCurrentConnectAddressAsync().ConfigureAwait(false);

            var currentEntry = await tempController.GetCurrentEntryAsync().ConfigureAwait(false);

            Assert.That(currentEntry, Is.SameAs(settings.Entries[0]));
        }
 public void GetShowCommandArguments_ReturnsCommandArguments()
 {
     Assert.That(
         NetshCommandFactory.GetShowCommandArguments(),
         Is.EqualTo("interface portproxy show v4tov4"));
 }
 public void Constructor_ValidProcessRunner_DoesNotUpdateCurrentEntry()
 {
     processRunner.DidNotReceive().RunAsync(
         Arg.Is(NetshCommandFactory.Executable),
         Arg.Is(NetshCommandFactory.GetShowCommandArguments()));
 }