public void Initialize()
        {
            _mockHttp = new MockHttpMessageHandler();
            _client   = new HttpClient(_mockHttp);

            _webApps = new Dictionary <string, WebAppConfig>
            {
                {
                    "fakeApp",
                    new WebAppConfig
                    {
                        PortNumber = 1234,
                        SubDomain  = "fake-app"
                    }
                }
            };

            _mockErrorDisplay = new Mock <IErrorDisplayFunc>();
            _mockErrorDisplay.Setup(x => x.ShowError(It.IsAny <string>()))
            .Returns(Task.FromResult(0))
            .Verifiable("Error display not called.");

            _ngrokProcess = new FakeNgrokProcess("");
            _utils        = new NgrokUtils(_webApps, "", _mockErrorDisplay.Object.ShowError, _client, _ngrokProcess);

            _emptyTunnelsResponse = new NgrokTunnelsApiResponse
            {
                tunnels = new Tunnel[0],
                uri     = ""
            };

            _expectedRequest = new NgrokTunnelApiRequest
            {
                addr        = "localhost:1234",
                host_header = "localhost:1234",
                name        = "fakeApp",
                proto       = "http",
                subdomain   = "fake-app"
            };
        }
Esempio n. 2
0
 private void InitializeUtils(string stdout)
 {
     _ngrokProcess = new FakeNgrokProcess(_tempFile, stdout);
     _utils        = new NgrokUtils(_webApps, _tempFile, _mockErrorDisplay.Object.ShowError, _client, _ngrokProcess);
 }