Example #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                              LandingPageContext landingPageContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseStatusCodePages();
            // V2
            // Add 'Automapper' through NuGet
            // Associate mappings between 'Entities' and 'Models'
            AutoMapper.Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <Entities.LandingPageSummary, Models.LandingPageSimple>();
                cfg.CreateMap <Entities.LandingPageSummary, Models.LandingPageSummaryDto>();
                cfg.CreateMap <Entities.LandingPageDetail, Models.LandingPageDetailDto>();

                cfg.CreateMap <Models.LandingPageDetailCreationDto, Entities.LandingPageDetail>();
                cfg.CreateMap <Entities.LandingPageDetail, Models.LandingPageDetailCreationDto>();
            });
            app.UseMvc();

            landingPageContext.EnsureSeedDataForContext();
        }
        public void FilterByCore()
        {
            // arrange
            _driver.Url = _url;
            var landingPageContext         = new LandingPageContext(_driver);
            var cpuPageContext             = new CPUPageContext(_driver);
            var filteringResultPageContext = new FilteringResultPageContext(_driver);

            //act
            landingPageContext.ClickOnMenuSubSection();
            cpuPageContext.SelectCore();
            filteringResultPageContext.WaitForLoaded();
            var actualResult = filteringResultPageContext.GetCoreFilteringResult().Select(a => int.Parse(a) >= 16).ToList();

            //assert
            foreach (var listElement in actualResult)
            {
                Assert.True(listElement, "Expected that cores amount are more or equal to 16");
            }
        }
        public void FilteringByCPU()
        {
            //arrange
            _driver.Url = _url;
            var landingPageContext         = new LandingPageContext(_driver);
            var cpuPageContext             = new CPUPageContext(_driver);
            var filteringResultPageContext = new FilteringResultPageContext(_driver);
            var expectedResult             = "Intel Core i7";

            //act
            landingPageContext.ClickOnMenuSubSection();
            cpuPageContext.SelectBrand();
            filteringResultPageContext.WaitForLoaded();
            var actualResult = filteringResultPageContext.GetCPUFilteringResult();

            //assert
            foreach (var listElement in actualResult)
            {
                Assert.True(listElement.Contains(expectedResult), $"{listElement} should contain {expectedResult}");
            }
        }
        public void FilterByProducer()
        {
            //arrange
            _driver.Url = _url;
            var landingPageContext         = new LandingPageContext(_driver);
            var cpuPageContext             = new CPUPageContext(_driver);
            var filteringResultPageContext = new FilteringResultPageContext(_driver);
            var expectedResult             = "Intel";

            //act
            landingPageContext.ClickOnMenuSubSection();
            cpuPageContext.SelectProducer();
            filteringResultPageContext.WaitForLoaded();
            var actualResult = filteringResultPageContext.GetProducerFilteringResult();

            //assert

            foreach (var listElement in actualResult)
            {
                Console.WriteLine(listElement);
                Assert.True(listElement.Contains(expectedResult), $"{listElement} should contain {actualResult}");
            }
        }
Example #5
0
 public LandingPageRepository(LandingPageContext context)
 {
     _context = context;
 }
        public static void EnsureSeedDataForContext(this LandingPageContext context)
        {
            if (context.LandingPageSummaries.Any())
            {
                return;
            }

            var landingPageSummaries = new List <LandingPageSummary>()
            {
                new LandingPageSummary()
                {
                    Name               = "Google",
                    Url                = "mail.google.com",
                    Description        = "My google account.",
                    LandingPageDetails = new List <LandingPageDetail>()
                    {
                        new LandingPageDetail()
                        {
                            UserId      = "*****@*****.**",
                            Password    = "******",
                            Description = "My first google account"
                        },
                        new LandingPageDetail()
                        {
                            UserId      = "*****@*****.**",
                            Password    = "******",
                            Description = "My second google account"
                        },
                    }
                },
                new LandingPageSummary()
                {
                    Name               = "Apple",
                    Url                = "mail.apple.com",
                    Description        = "My apple account.",
                    LandingPageDetails = new List <LandingPageDetail>()
                    {
                        new LandingPageDetail()
                        {
                            UserId      = "*****@*****.**",
                            Password    = "******",
                            Description = "My first apple account"
                        },
                        new LandingPageDetail()
                        {
                            UserId      = "*****@*****.**",
                            Password    = "******",
                            Description = "My second apple account"
                        },
                    }
                },
                new LandingPageSummary()
                {
                    Name               = "Bank Of America",
                    Url                = "mailbofa.google.com",
                    Description        = "My Bofa account.",
                    LandingPageDetails = new List <LandingPageDetail>()
                    {
                        new LandingPageDetail()
                        {
                            UserId      = "*****@*****.**",
                            Password    = "******",
                            Description = "My first Bofa account"
                        },
                        new LandingPageDetail()
                        {
                            UserId      = "*****@*****.**",
                            Password    = "******",
                            Description = "My second Bofa account"
                        },
                    }
                }
            };

            context.LandingPageSummaries.AddRange(landingPageSummaries);
            context.SaveChanges();
        }