public async Task ShouldRejectForecastReportAsBadRequestWhenTemperatureIsLessThanMinus100()
        {
            //GIVEN
            await using var driver = new AppDriver();
            await driver.StartAsync();

            //WHEN
            using var reportForecastResponse = await driver.WeatherForecastApi.AttemptToReportForecast(
                      request => request with { TemperatureC = -101 });
示例#2
0
        public async Task ShouldRejectForecastReportAsBadRequestWhenTemperatureIsBelowAllowedMinimum()
        {
            //GIVEN
            await using var driver = new AppDriver();
            await driver.StartAsync();

            using var user = new User(driver);

            //WHEN
            using var reportForecastResponse =
                      await user.AttemptToReportNewForecast(forecast => forecast with { TemperatureC = -101 });
        public async Task ShouldAllowRetrievingReportedForecast()
        {
            //GIVEN
            await using var driver = new AppDriver();
            await driver.StartAsync();

            await driver.WeatherForecastApi.ReportForecast();

            //WHEN
            using var retrievedForecast = await driver.WeatherForecastApi.GetReportedForecast();

            //THEN
            await retrievedForecast.ShouldBeTheSameAsReported();

            //not really part of the scenario...
            driver.Notifications.ShouldIncludeNotificationAboutReportedForecast();
        }
示例#4
0
        public async Task ShouldAllowRetrievingReportedForecast()
        {
            //GIVEN
            await using var driver = new AppDriver();
            await driver.StartAsync();

            using var user = new User(driver);

            await user.ReportNewForecast();

            //WHEN
            using var retrievedForecast = await user.RetrieveLastReportedForecast();

            //THEN
            await retrievedForecast.ShouldBeTheSameAs(user.LastReportedForecast());

            //not really part of the scenario...
            driver.Notifications.ShouldIncludeNotificationAbout(user.LastReportedForecast());
        }
示例#5
0
        public async Task ShouldAllowRetrievingReportsFromAParticularUser()
        {
            //GIVEN
            await using var driver = new AppDriver();
            await driver.StartAsync();

            using var user1 = new User(driver);
            using var user2 = new User(driver);

            await user1.ReportNewForecast();

            await user1.ReportNewForecast();

            await user2.ReportNewForecast();

            //WHEN
            using var allForecastsReportedByUser1 = await user1.RetrieveAllReportedForecasts();

            //THEN
            await allForecastsReportedByUser1.ShouldConsistOf(user1.AllReportedForecasts());
        }