public async Task Including_ServerSide_Middleware_from_AssemblyMetaData_TestAsync() { using var sampleAppWorkDir = SampleSite.CreateSampleAppsWorkDir(); var projectDir = Path.Combine(sampleAppWorkDir, "BlazorWasmApp0"); using var dotnetCLI = Start( "dotnet", "publish -c:Release -p:BlazorWasmPrerenderingKeepServer=true -p:BlazorEnableCompression=false -p:UsingBrowserRuntimeWorkload=false", projectDir, options => options.WhenDisposing = XProcessTerminate.EntireProcessTree); var success = await dotnetCLI.WaitForOutputAsync(output => output.Trim().StartsWith("Start fetching..."), millsecondsTimeout : 15000); if (!success) { throw new Exception(dotnetCLI.Output); } using var httpClient = new HttpClient(); var httpResponse = await httpClient.GetAsync("http://127.0.0.1:5050/"); httpResponse.EnsureSuccessStatusCode(); httpResponse.Headers.TryGetValues("X-Middleware1-Version", out var values1).IsTrue(); values1.Is("1.0.0.0"); httpResponse.Headers.TryGetValues("X-Middleware2-Version", out var values2).IsTrue(); values2.Is("2.0.0.0"); }
public EditSampleSiteContent(TabItemParent mainTabItem, SampleSite sampleSite = null) : base(mainTabItem) { InitializeComponent(); if (sampleSite == null) { sampleSite = new SampleSite(); createFlag = true; } this.DataContext = this.sampleSite = sampleSite; }
public HttpClient CreateClient(string resource = null) { if (_createdSite != null) { _createdSite.RefreshClient(resource); return(_createdSite.Client); } _createdSite = _siteCreator(resource); return(_createdSite.Client); }
/// <summary> /// If urls exist => create and add else add /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SampleSitesComboboxSelect(ComboBox combobox) { SampleSite sampleSite = null; if (combobox.SelectedItem == null) { if ( String.IsNullOrWhiteSpace(combobox.Text) || !Helper.IsValidURL(combobox.Text) ) // if text is empty or text is not url { MessageBox.Show("Нельзя добавить к требованию данный сайт! Ошибка url.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (demand.SampleSites.ToList().Select(v => v.siteURL).Contains(combobox.Text)) { MessageBox.Show("Нельзя добавить к требованию данный сайт! Данный сайт уже прикреплен к требованию!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); SampleSitesList.SelectedItem = demand.SampleSitesGroup.ToList().Where(v => v.SampleSite.siteURL == combobox.Text).FirstOrDefault(); return; } if (MessageBox.Show("Вы хотите добавить сайт в систему?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { sampleSite = new SampleSite(); sampleSite.siteURL = combobox.Text; SitesCreateEntities.GetContext().SampleSite.Add(sampleSite); SitesCreateEntities.GetContext().SaveChanges(); SitesCreateEntities.GetContext().ChangeTracker.Entries().ToList().ForEach(v => v.Reload()); // add new URL Site } else { return; } } if (sampleSite == null) { sampleSite = (SampleSite)combobox.SelectedItem; } var dialog = new Dialog("Введите примечания."); if (dialog.ShowDialog() == true) { var sampleSitesGroup = new SampleSitesGroup(); sampleSitesGroup.sampleSiteId = sampleSite.id; sampleSitesGroup.demandId = demand.id; sampleSitesGroup.note = dialog.Answer; try { SitesCreateEntities.GetContext().SampleSitesGroup.Add(sampleSitesGroup); SitesCreateEntities.GetContext().SaveChanges(); SitesCreateEntities.GetContext().ChangeTracker.Entries().ToList().ForEach(v => v.Reload()); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); SitesCreateEntities.GetContext().ClearStateAndReloadAll(); } } Update(); }