Esempio n. 1
0
 public Context()
 {
     Simulator.HostingProvider = Substitute.For<SelfHostProvider>();
     simulator = new Simulator(null);
 }
Esempio n. 2
0
 public Context()
 {
     simulator = new Simulator(null);
     controller = new SimulatorController(simulator);
     controller.Request = request = new HttpRequestMessage(HttpMethod.Delete, "http://localhost/");
 }
Esempio n. 3
0
 public void SetUp()
 {
     //  Start the simulator on port 3000
     simulator = Simulator.Start(3000);
 }
Esempio n. 4
0
        /// <summary>
        /// Creates a simulator and starts it running on the specified port.
        /// </summary>
        /// <param name="port">The port number of the simulator's HTTP port.</param>
        /// <returns>The simulator that can be configured with responses, and whose requests can be examined.</returns>
        public static Simulator Start(int port)
        {
            //  Configure the HTTP server
            var configuration = new HttpSelfHostConfiguration("http://localhost:" + port);
            configuration.Routes.MapHttpRoute(
                name: "Simulator",
                routeTemplate: "{*path}",
                defaults: new { controller = "Simulator", action = "Simulate" }
            );

            //  Start the HTTP server
            var server = new HttpSelfHostServer(configuration);
            var simulator = new Simulator(server);
            HostingProvider.Open(server);

            //  Use our custom dependency resolution
            configuration.DependencyResolver = new DependencyResolver(simulator);

            return simulator;
        }
Esempio n. 5
0
 public Context()
 {
     simulator = new Simulator(null);
     resolver = new DependencyResolver(simulator);
 }