Esempio n. 1
0
        public async Task RefreshCurrentConnectAddressAsync()
        {
            var parser = new CommandResultParser {
                ListenAddress = config.ListenAddress
            };

            currentAddress = parser.GetCurrentProxyAddress(
                await processRunner.RunAsync(
                    NetshCommandFactory.Executable,
                    NetshCommandFactory.GetShowCommandArguments()).ConfigureAwait(false));
        }
        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>"));
        }