public IEnumerable <IRecord> ToIRecord(searchResults results) { var records = new List <WOSRecord>(); if (results.records == null) { return(records); } foreach (var r in results.records) { records.Add(new WOSRecord { Title = r.title.First().value[0], Authors = r.authors.SelectMany(x => x.value.Select(y => { var s = y.Split(new[] { ',' }); return(new Author { FirstName = s[1], SecondName = s[0] }); })).ToList(), PublicationDate = new PublicationDateTime(r), }); } return(records); }
private void button10_Click(object sender, EventArgs e) { Queue <park> Q = new Queue <park>(); Q.Enqueue(p1); label1.Text = "Working ..."; Application.DoEvents(); searchResults r = parkSpaceLogic.SpaceSearch2(Q); int sol_count = r.solutions.Count; int steps_to_sol = -1; if (sol_count > 0) { r = parkSpaceLogic.SpaceSearch2(r.solutions); p1 = r.lastNode; steps_to_sol = r.distance_counter - 1; pictureBox1.Refresh(); } label1.Text = r.states.ToString() + " states, " + sol_count.ToString() + " solution(s), steps to solution: " + steps_to_sol.ToString();; }
private void button4_Click(object sender, EventArgs e) { Queue <park> Q = new Queue <park> (); Q.Enqueue(p1); label1.Text = "Working ..."; Application.DoEvents(); searchResults r = parkSpaceLogic.SpaceSearch2(Q); int sol_count = 0; int steps_to_sol = -1; if (r.solutions != null) { sol_count = r.solutions.Count; } int state_count = r.states; if (r.solutions.Count > 0) { searchResults r2 = parkSpaceLogic.SpaceSearch2(r.solutions); steps_to_sol = r2.D[p1.GetHashCode()]; } label1.Text = state_count.ToString() + " states, " + sol_count.ToString() + " solution(s), " + steps_to_sol.ToString() + " steps to solution"; }
public searchResults Build() { var view = new searchResults { ViewData = { Model = _viewModel } }; return(view); }
private void button8_Click(object sender, EventArgs e) { label1.Text = "Solving ..."; Queue <park> Q = new Queue <park>(); Q.Enqueue(p1); searchResults r = parkSpaceLogic.SpaceSearch2(Q); if (r.solutions.Count == 0) { MessageBox.Show("No solutions found!", "Error"); return; } searchResults r2 = parkSpaceLogic.SpaceSearch2(r.solutions); int current_steps_to_sol = r2.D[p1.GetHashCode()]; int moveCount = 0; while (current_steps_to_sol > 0) { moveCount++; movesList L = parkLogic.generateMoves2(p1); for (int i = 0; i < L.count; i++) { park p2 = p1.Clone(); p2 = parkLogic.makeMove2(p2, L.car_ind[i], L.dir[i]); int steps_to_sol = r2.D[p2.GetHashCode()]; if (steps_to_sol < current_steps_to_sol) { current_steps_to_sol = steps_to_sol; p1 = parkLogic.makeMove2(p1, L.car_ind[i], L.dir[i]); pictureBox1.Refresh(); Application.DoEvents(); System.Threading.Thread.Sleep(250); break; } } } label1.Text = "Done1"; }
public void NoResults() { var results = new searchResults(); var view = results.RenderAsHtml(new ApprenticeshipSearchResponseViewModel { VacancySearch = new ApprenticeshipSearchViewModel() }); view.GetElementbyId("sort-results").Should().BeNull(); view.GetElementbyId("search-no-results-title").Should().NotBeNull(); }
public void ShowApprenticeshipLevelAdvice() { var results = new searchResults(); var view = results.RenderAsHtml(new ApprenticeshipSearchResponseViewModel { VacancySearch = new ApprenticeshipSearchViewModel { ApprenticeshipLevel = "Intermediate" }, }); view.GetElementbyId("search-no-results-apprenticeship-levels").Should().NotBeNull(); }
public void Category_NoResults() { var results = new searchResults(); var searchViewModel = Mediator.Index(null, ApprenticeshipSearchMode.Category, false).ViewModel; searchViewModel.Category = "1"; var searchResultsViewModel = Mediator.Results(null, searchViewModel).ViewModel; var view = results.RenderAsHtml(searchResultsViewModel); view.GetElementbyId("search-no-results").Should().NotBeNull(); view.GetElementbyId("search-no-results-category").Should().NotBeNull(); view.GetElementbyId("search-no-results-sub-category").Should().BeNull(); }
public void ShowNoResultsReferenceNumber() { var results = new searchResults(); var view = results.RenderAsHtml(new ApprenticeshipSearchResponseViewModel { VacancySearch = new ApprenticeshipSearchViewModel { SearchMode = ApprenticeshipSearchMode.Keyword, Keywords = "VAC000514705" }, }); view.GetElementbyId("search-no-results-reference-number").Should().NotBeNull(); view.GetElementbyId("search-no-results-keywords").Should().BeNull(); }
public void TC_AddProductToBasket([Values("ipad", "iphone")] string products) { test = extent.CreateTest("Test Case to Search " + products); var homePage = new home(); var loginPage = new login(driver); var searchPage = new searchResults(driver); var productDetailPage = new productDetail(driver); var basketPage = new basket(driver); string productNameCaptured; //Login to Amazon test.Log(Status.Info, "Login to Amamzon website"); //Assert.IsTrue(homePage.verifyHomePage("Sign in"), "Amamzon home page is unavailable"); AllClassesObjects aco = new AllClassesObjects(); Assert.IsTrue(aco.homePage.verifyHomePage("Sign in"), "Amamzon home page is unavailable"); homePage.clickOnSignIn(); loginPage.setUser_email(ConfigurationManager.AppSettings.Get("email")); loginPage.clickOnContinue(); loginPage.setUser_password(ConfigurationManager.AppSettings.Get("password")); loginPage.clickOnSubmit(); Assert.IsTrue(homePage.verifyHomePage(ConfigurationManager.AppSettings.Get("user")), "User is not logged in"); test.Log(Status.Info, "Login successfull"); //Search the product in Amazon homePage.setSearch_Product(products); homePage.clickOnSearchBtn(); productNameCaptured = searchPage.getFirstProductName(); searchPage.verifyProductLandPage(products); test.Log(Status.Info, "The first product name from search list: " + productNameCaptured); searchPage.clickOnFirstProduct(); //Add product to cart Assert.IsTrue(productDetailPage.verifyProduct(productNameCaptured), "Failed to verify the product: " + productNameCaptured); productDetailPage.clickOnAddToCartBtn(); Assert.IsTrue(basketPage.verifyProductAddedToCart(), "Failed to add product to basket"); test.Log(Status.Info, "Successfully added product to Basket"); }
public IEnumerable <IRecord> ToIRecord(searchResults results) { throw new NotImplementedException(); }
// Always update the SearchResults property with the latest item from the searchResults observable _SearchResults = this.ObservableToProperty(searchResults, x => x.SearchResults);
private void button3_Click(object sender, EventArgs e) { MIN_SOLS = (int)numericUpDown4.Value; int trials = 0; int max_sol_steps = 0; //string sols_vector = ""; park p = new park(); park best_park = new park(); button3.Enabled = false; button2.Enabled = true; Application.DoEvents(); DateTime st = DateTime.Now; while (!ABORT_FLAG) //for (int i=0; i<1000; i++) { p = parkLogic.generatePark(PUZZLE_WIDTH, PUZZLE_HEIGHT, CARS); trials++; label1.Text = "Searching ... (tried " + trials.ToString() + " configuations, max solution steps = " + max_sol_steps.ToString() + ")"; this.Refresh(); Application.DoEvents(); if (p.count < CARS) { continue; } Queue <park> Q = new Queue <park>(); Q.Enqueue(p); searchResults r = parkSpaceLogic.SpaceSearch2(Q); if (r.states < 1) { continue; } if (r.solutions.Count == 0) { continue; } r = parkSpaceLogic.SpaceSearch2(r.solutions); p = r.lastNode; int steps_to_sol = r.distance_counter - 1; if (steps_to_sol > max_sol_steps) { best_park = p; max_sol_steps = steps_to_sol; } if (steps_to_sol >= MIN_SOLS) { StreamWriter res_file = File.AppendText(Directory.GetCurrentDirectory() + "\\car_park_puzzles.txt"); res_file.WriteLine(steps_to_sol.ToString("00 solutions: ") + p.ToString()); res_file.Flush(); res_file.Close(); } } // this.Text = DateTime.Now.Subtract(st).TotalSeconds.ToString(); p1 = best_park; generateColorTab(); updateInterface(); button4_Click(null, null); button3.Enabled = true; button2.Enabled = false; ABORT_FLAG = false; //Clipboard.SetText(sols_vector); }