예제 #1
0
        public async Task ThenTheDeliveryModesForEachProviderAreDisplayed(string not)
        {
            var json = DataFileManager.GetFile("course-providers.json");
            var expectedApiResponse = JsonConvert.DeserializeObject <TrainingCourseProviders>(json);

            var response      = _context.Get <HttpResponseMessage>(ContextKeys.HttpResponse);
            var actualContent = await response.Content.ReadAsStringAsync();

            foreach (var mode in Enum.GetValues(typeof(DeliveryModeType)).Cast <DeliveryModeType>())
            {
                if (mode == DeliveryModeType.NotFound || mode == DeliveryModeType.National)
                {
                    continue;
                }
                var modeName = mode.GetDescription().Replace("’", "&#x2019;");// for some reason HtmlEncode doesn't encode '’'

                if (not == string.Empty)
                {
                    actualContent.Should().Contain(modeName, Exactly.Times(expectedApiResponse.Total + 1));// additional time in the filter ui
                }
                else
                {
                    actualContent.Should().NotContain(modeName);
                }
            }
        }
        public async Task ThenThePageContentIncludesTheEpaoName()
        {
            var response = _context.Get <HttpResponseMessage>(ContextKeys.HttpResponse);

            var actualContent = await response.Content.ReadAsStringAsync();

            var json = DataFileManager.GetFile("course-epao.json");
            var expectedApiResponse = JsonConvert.DeserializeObject <CourseEpao>(json);

            actualContent.Should().Contain(HttpUtility.HtmlEncode(expectedApiResponse.Epao.Name));
        }
예제 #3
0
        public async Task ThenThereIsARowForEachCourse()
        {
            var response = _context.Get <HttpResponseMessage>(ContextKeys.HttpResponse);

            var actualContent = await response.Content.ReadAsStringAsync();

            var json = DataFileManager.GetFile("course-list.json");
            var expectedApiResponse = JsonConvert.DeserializeObject <CourseList>(json);

            foreach (var course in expectedApiResponse.Courses)
            {
                actualContent.Should().Contain(HttpUtility.HtmlEncode(course.Title));
            }
        }
예제 #4
0
        public async Task ThenTheSectorsAndLevelsAreAvailableToFilter()
        {
            var response = _context.Get <HttpResponseMessage>(ContextKeys.HttpResponse);

            var actualContent = await response.Content.ReadAsStringAsync();

            var json = DataFileManager.GetFile("courses.json");
            var expectedApiResponse = JsonConvert.DeserializeObject <TrainingCourses>(json);

            foreach (var sector in expectedApiResponse.Sectors)
            {
                actualContent.Should().Contain(HttpUtility.HtmlEncode(sector.Route));
            }
            foreach (var level in expectedApiResponse.Levels)
            {
                actualContent.Should().Contain($"Level {level.Code} - {HttpUtility.HtmlEncode(level.Name)}");
            }
        }