Example #1
0
 public void WillRespondWith(ContractResponse response)
 {
     if (buildingContract.Request == null)
     {
         throw new Exception("Request not defined for response");
     }
     buildingContract.Response = response;
     contracts.Add(buildingContract);
     buildingContract = new Contract();
 }
Example #2
0
        public MockProviderService(int port)
        {
            Port = port;

            _host = Host.CreateDefaultBuilder().ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseUrls(BaseAddress);
                webBuilder.Configure((WebHostBuilderContext context, IApplicationBuilder app) =>
                {
                    app.UseRouting();
                    app.UseEndpoints(endpoints => { endpoints.Map("/{**slug}", RequestHandler); });
                });
            }).Build();
            _host.RunAsync();
            buildingContract = new Contract();
            contracts        = new List <Contract>();
        }