public void GivenAndMyJokeProviderWillGiveMeTheseJokesInOrder(Table table)
        {
            TestingApplicationFactory <Startup> factory = _featureContext["factory"] as TestingApplicationFactory <Brenda.Startup>;

            foreach (var joke in table.Rows.Select(r => r[0]))
            {
                factory.HttpMessageHandler.Responses.Enqueue(joke);
            }
        }
        public void GivenIKnowAboutTheFollowingForecast(Table table)
        {
            TestingApplicationFactory <Startup> factory = _featureContext["factory"] as TestingApplicationFactory <Brenda.Startup>;

            using (var db = factory.Context)
            {
                var records = table.CreateSet <Forecast>();
                db.Forecasts.RemoveRange(db.Forecasts);
                db.Forecasts.AddRange(records);
                db.SaveChanges();
            }
        }
        public ForecastApiSteps(FeatureContext featureContext)
        {
            _featureContext = featureContext;
            TestingApplicationFactory <Startup> factory = featureContext["factory"] as TestingApplicationFactory <Brenda.Startup>;

            _client = factory.WithWebHostBuilder(builder =>
            {
                builder.ConfigureServices(services =>
                {
                    services.AddAuthentication("Test")
                    .AddScheme <AuthenticationSchemeOptions, TestAuthHandler>(
                        "Test", options => { });
                });
            }).CreateClient(new WebApplicationFactoryClientOptions
            {
                AllowAutoRedirect = false,
                HandleCookies     = false
            });
        }
 public static void BeforeFeature(FeatureContext featureContext)
 {
     featureContext["factory"] = new TestingApplicationFactory <Brenda.Startup>();
 }
 public IntegrationTests(TestingApplicationFactory <Startup> factory)
 {
     _factory = factory;
 }