Example #1
0
        private void SetupDbState()
        {
            var optedIn = Context.Providers.First(x => x.ProviderCode == OptedInProviderCode && x.OptedIn);

            var allTypes = Enum.GetValues(typeof(CourseType)).Cast <CourseType>().ToArray();

            Context.Courses.Add(CourseBuilder.Build("allTypes", allTypes, optedIn));

            allTypes = allTypes.Where(x => x != CourseType.RunningPublished).ToArray();

            Context.Courses.Add(CourseBuilder.Build("allTypes_1", allTypes, optedIn));

            allTypes = allTypes.Where(x => x != CourseType.RunningUnpublished).ToArray();

            Context.Courses.Add(CourseBuilder.Build("allTypes_2", allTypes, optedIn));

            allTypes = allTypes.Where(x => x != CourseType.NewUnpublished).ToArray();

            Context.Courses.Add(CourseBuilder.Build("allTypes_3", allTypes, optedIn));

            allTypes = allTypes.Where(x => x != CourseType.NewPublished).ToArray();

            Context.Courses.Add(CourseBuilder.Build("allTypes_4", allTypes, optedIn));
            Context.Save();
        }
        private void SetupDbState()
        {
            var optedInWithExistingCourse = Context.Providers.First(x => x.ProviderCode == OptedInWithExistingCourseProviderCode && x.OptedIn == true);

            // There is a manuel intervention that addresses concerning existing course that are new for an opted in provider.
            var optedInProviderExistingCourse = CourseBuilder.Build(CourseType.NewUnpublished, optedInWithExistingCourse);

            optedInProviderExistingCourse.Update(x => {
                // The manuel intervention, replace it with running & published status
                x.CourseSites = new List <CourseSite> {
                    CourseSiteBuilder.Build(CourseType.RunningPublished)
                };
            });

            Context.Courses.Add(optedInProviderExistingCourse);

            Context.Save();
        }
Example #3
0
        private void SetupDbState()
        {
            var optedIn = Context.Providers.First(x => x.ProviderCode == OptedInProviderCode && x.OptedIn);

            // Relic data
            Context.Courses.Add(CourseBuilder.Build(CourseType.SuspensedUnpublished, optedIn));
            Context.Courses.Add(CourseBuilder.Build(CourseType.SuspensedPublished, optedIn));
            Context.Courses.Add(CourseBuilder.Build(CourseType.DiscontinuedUnpublished, optedIn));
            Context.Courses.Add(CourseBuilder.Build(CourseType.DiscontinuedPublished, optedIn));


            // Transition has started
            // New course has been added to database hence course is new as the course site is new
            Context.Courses.Add(CourseBuilder.Build(CourseType.NewUnpublished, optedIn));
            Context.Courses.Add(CourseBuilder.Build(CourseType.NewPublished, optedIn));

            // Somehow course has a running site
            Context.Courses.Add(CourseBuilder.Build(CourseType.RunningUnpublished, optedIn));
            Context.Courses.Add(CourseBuilder.Build(CourseType.RunningPublished, optedIn));

            Context.Save();
        }
Example #4
0
        protected override void Setup()
        {
            Course course2019 = CourseBuilder
                                .Build(CourseType.RunningPublished,
                                       new ProviderBuilder()
                                       .WithCycle("2019")
                                       .WithCode(ProviderCode))
                                .WithName(CourseName2019)
                                .WithAccreditingProvider(
                new ProviderBuilder()
                .WithCycle("2019")
                .WithCode(AccreditingProviderCode)
                );
            Course course2020 = CourseBuilder
                                .Build(CourseType.RunningPublished,
                                       new ProviderBuilder()
                                       .WithCycle("2020")
                                       .WithCode(ProviderCode))
                                .WithName("Operatics 2020")
                                .WithAccreditingProvider(
                new ProviderBuilder()
                .WithCycle("2020")
                .WithCode(AccreditingProviderCode)
                );

            Context.Courses.Add(course2019);
            Context.Courses.Add(course2020);
            var updatedAt    = new DateTime(2001, 02, 03, 04, 05, 06);
            var jsonData2019 = @"
            {
                ""Email"": ""*****@*****.**"",
                ""Website"": ""http://example.org"",
                ""Address1"": ""add1"",
                ""Address2"": ""add2"",
                ""Address3"": ""add3"",
                ""Address4"": ""add4"",
                ""Postcode"": ""SW1A 1AA"",
                ""Telephone"": ""0123321"",
                ""RegionCode"": 5,
                ""TrainWithUs"": """ + TrainWithUs2019 + @""",
                ""TrainWithDisability"": """ + TrainWithDisability2019 + @""",
                ""AccreditingProviderEnrichments"": [
                {
                    ""Description"": """ + AboutAccreditingProvider2019 + @""",
                    ""UcasProviderCode"": """ + AccreditingProviderCode + @"""
                }
                ]
            }";

            var jsonData2020 = @"
            {
                ""Email"": ""2020"",
                ""Website"": ""2020"",
                ""Address1"": ""2020"",
                ""Address2"": ""2020"",
                ""Address3"": ""2020"",
                ""Address4"": ""2020"",
                ""Postcode"": ""2020"",
                ""Telephone"": ""2020"",
                ""RegionCode"": 5,
                ""TrainWithUs"": ""2020"",
                ""TrainWithDisability"": ""2020"",
                ""AccreditingProviderEnrichments"": [
                {
                    ""Description"": ""2020"",
                    ""UcasProviderCode"": """ + AccreditingProviderCode + @"""
                }
                ]
            }";

            course2019.Provider.ProviderEnrichments.Add(
                new ProviderEnrichment
            {
                ProviderCode  = ProviderCode,
                UpdatedAt     = updatedAt,
                JsonData      = jsonData2019,
                Status        = EnumStatus.Published,
                CreatedByUser = new User(),
                UpdatedByUser = new User()
            });

            course2020.Provider.ProviderEnrichments.Add(
                new ProviderEnrichment
            {
                ProviderCode  = ProviderCode,
                UpdatedAt     = updatedAt.AddYears(1),
                JsonData      = jsonData2020,
                Status        = EnumStatus.Published,
                CreatedByUser = new User(),
                UpdatedByUser = new User()
            });

            Context.Save();
        }