コード例 #1
0
        public void ShouldReturnCorrectConfiguredAdminPort()
        {
            var config   = HoverflyConfig.Config().SetAdminPort(8880);
            var hoverfly = new Hoverfly(HoverflyMode.Simulate, config);

            Assert.Equal(8880, hoverfly.GetAdminPort());
        }
コード例 #2
0
        public void ShouldUseRemoteHovervyInstance()
        {
            var config = HoverflyConfig.Config().SetHoverflyBasePath(HoverFlyTestConfig.PackagePath);

            using (var hoverfly = new Hoverfly(HoverflyMode.Simulate, config))
            {
                hoverfly.Start();

                hoverfly.ImportSimulation(
                    DslSimulationSource.Dsl(
                        Service("http://echo.jsontest.com")
                        .Get("/key/value/three/four")
                        .QueryParam("name", "test")
                        .WillReturn(
                            Success("{\n   \"three\": \"four\",\n   \"key\": \"value\"\n}\n", "application/json"))));

                var simulation = hoverfly.GetSimulation();

                var config2 = HoverflyConfig.Config().UseRemoteInstance(config.RemoteHost, config.ProxyPort, config.AdminPort);
                using (var reuseHoverfly = new Hoverfly(config: config2))
                {
                    var simulation2 = reuseHoverfly.GetSimulation();

                    Assert.Equal(hoverfly.GetAdminPort(), reuseHoverfly.GetAdminPort());
                    Assert.Equal(hoverfly.GetProxyPort(), reuseHoverfly.GetProxyPort());
                    Assert.Equal(simulation.HoverflyData.RequestResponsePair.First().Response.Body, simulation2.HoverflyData.RequestResponsePair.First().Response.Body);
                }
            }
        }