public IntegrationTestBase() { App = new CliAppBuilder <ApplicationRoot>() .Configure(c => c.AddJsonFile("appsettings.json")) .RegisterServices(RegisterServices) .Build(); }
private void DrawSineLowLevel(ApplicationRoot app, Element canvasDraw) { SmartAction(new Click(app, LAPIS)); app.SetFocus(); Wait(200); var rect = canvasDraw.GetRect(); var twoPI = Math.PI * 20.0; var height = ((rect.Y + rect.Height) / 2) - 10; var sineHeight = height / 2; var width = rect.Width; var initialX = 10; var initialY = sineHeight * Math.Sin((twoPI * initialX) / width) + (sineHeight + rect.Y + 20); Mouse.ButtonUp(); Mouse.Move(initialX, initialY); Mouse.ButtonDown(MouseButton.Left); for (var x = initialX; x < width; x++) { var y = sineHeight * Math.Sin((twoPI * x) / width) + (sineHeight + rect.Y + 20); Mouse.Move(x, y); Wait(1); } Mouse.ButtonUp(MouseButton.Left); }
private ICredentials GetCredentials() { if (null == _credentials) { var uri = new Uri(ApplicationRoot); var host = uri.Host; var app = ApplicationRoot.Split('/').Last(); var cs = Application.Current.Container.Get <ICredentialStorage>(); ICredentials credentials = null; if (null != cs) { credentials = cs.GetCredentials(host, app); if (null == credentials) { credentials = cs.GetCredentials(host); } } if (null == credentials) { if (null != LogonFunction) { credentials = LogonFunction(); } else { throw new Exception("no credentials or logon function provided"); } } _credentials = credentials; } return(_credentials); }
private void RedimensionarCanvas(ApplicationRoot app, Element canvasDraw) { SmartAction(new Click(app, REDIMENSIONAR)); SmartAction(new SelectRadioButton(app, RADIO_PIXEL)); SmartAction(new SetCheckBox(app, CHECK_BOX_MANTER_PROPORCAO, false)); SmartAction(new SetText(app, INPUT_WIDTH, canvasDraw.GetRect().Width.ToString())); SmartAction(new SetText(app, INPUT_HEIGHT, canvasDraw.GetRect().Height.ToString())); SmartAction(new Click(app, REDIMENSIONAR_OK)); }
/// <summary> /// 获取文件 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <List <FileRDto> > GetFileRDtoList(FileRInput input) { var query = _iFileRelationRepository.GetAll(); if (input.ModuleType.HasValue) { query = query.Where(x => x.ModuleId == input.ModuleType); } if (input.KeyId.HasValue) { query = query.Where(x => x.KeyId == input.KeyId); } var listDto = (await query.ToListAsync()).MapTo <List <FileRDto> >(); string applicationRootUrl = ApplicationRoot.EndsWith("/") ? ApplicationRoot : ApplicationRoot + "/"; foreach (var dto in listDto) { string ext = FileHelper.GetExtension(dto.FileName).ToLower(); dto.FileNameWithoutExten = dto.FileName.Substring(0, dto.FileName.IndexOf('.')); switch (ext) { case ".xlsx": case ".xls": dto.ImageShowUrl = applicationRootUrl + "Images/Excel.png"; break; case ".doc": case ".docx": dto.ImageShowUrl = applicationRootUrl + "Images/Word.png"; break; case ".ppt": case ".pptx": dto.ImageShowUrl = applicationRootUrl + "Images/PPT.png"; break; case ".txt": dto.ImageShowUrl = applicationRootUrl + "Images/Word.png"; break; case ".pdf": dto.ImageShowUrl = applicationRootUrl + "Images/pdf.png"; break; } switch (dto.FileType) { case FileType.Image: dto.ImageShowUrl = applicationRootUrl + "Ashx/ThumbImage.ashx?FID=" + dto.FileId; break; } dto.FileDownUrl = applicationRootUrl + "Ashx/DownloadFile.ashx?FID=" + dto.FileId + "&CID=" + dto.FileName; } return(listDto); }
async public static void GetIM_Step01_Application(HttpClient httpClient) { string destinationAddress = Program.destinationAddress; try { httpClient.DefaultRequestHeaders.Remove("Accept"); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ConfigData.ucwaAuthenticationResult.AccessToken); httpClient.DefaultRequestHeaders.Add("Accept", "application/json"); string url_00 = ConfigData.ucwaApplicationsHost + ConfigData.ucwaApplication;// + ConfigData.ucwaPeopleContact; ConfigData.Log("1", String.Format("Step 01 : POST : {0}", url_00)); ConfigData.Log("3", String.Format(">> Request: {0}", "Get")); ConfigData.Log("3", String.Format(">> URL: {0}", url_00)); var res_00 = await httpClient.GetAsync(url_00); string res_00_request = res_00.RequestMessage.ToString(); string res_00_headers = res_00.Headers.ToString(); string res_00_status = res_00.StatusCode.ToString(); var res_00_content = await res_00.Content.ReadAsStringAsync(); ConfigData.Log("3", String.Format(">> Response: {0}", res_00_status)); ConfigData.Log("3", String.Format("{0}", res_00_headers)); ConfigData.Log("3", String.Format("\r\n{0}", res_00_content)); if (res_00_status == "OK") { ConfigData.Log("2", String.Format(">> GetIM completed normally. {0}", "STEP01")); ApplicationRoot obj = new ApplicationRoot(); JsonConvert.PopulateObject(res_00_content, obj); if (obj != null) { ConfigData.ucwaApplication = obj._links.self.href; ConfigData.ucwaEvents = obj._links.events.href; } //GetIM_Step02_Contact(httpClient); GetIM_Step03_Events(httpClient); } else { ConfigData.Log("2", String.Format(">> GetIM ended abnormally. {0}", "STEP01")); } } catch (Exception ex) { ConfigData.Log("2", String.Format(">> Error in step 01. {0}", ex.InnerException.Message)); } }
private void WriteWelcomeText(ApplicationRoot mspaint, string textEditorWriteWelcomeText) { SmartAction(new SetText(mspaint, TEXT_EDITOR, "Welcome to your first bot")); Wait(2000); // Time to human reader SmartAction(new SetText(mspaint, TEXT_EDITOR, "For more instructions access the documentation in https://smartbot.com/developer")); Wait(3000); // Time to human reader SmartAction(new SetText(mspaint, TEXT_EDITOR, "Ok... i'm going :)")); Wait(2000); // Time to human reader SmartAction(new SetText(mspaint, TEXT_EDITOR, "Bye!")); Wait(1000); // Time to human reader }
public static string CreateUcwaApps(HttpClient httpClient, OAuthTokenRoot authToken, string ucwaApplicationsRootUri, UcwaMyApps ucwaAppsObject, TelemetryClient tc) { try { string createUcwaAppsResults = string.Empty; httpClient.DefaultRequestHeaders.Clear(); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken.access_token); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var createUcwaPostData = JsonConvert.SerializeObject(ucwaAppsObject); var httpResponseMessage = httpClient.PostAsync(ucwaApplicationsRootUri, new StringContent(createUcwaPostData, Encoding.UTF8, "application/json")).Result; if (httpResponseMessage.IsSuccessStatusCode) { tc.TrackTrace("Application on the UCWA server created successfully."); Console.WriteLine("Application on the UCWA server created successfully."); createUcwaAppsResults = httpResponseMessage.Content.ReadAsStringAsync().Result; ApplicationRoot obj = new ApplicationRoot(); JsonConvert.PopulateObject(createUcwaAppsResults, obj); if (obj != null) { ConfigData.ucwaApplication = obj._links.self.href; // ConfigData.ucwaApplications += ConfigData.ucwaApplication; ConfigData.ucwaEvents = obj._links.events.href; } } else { tc.TrackTrace("Failed to create application on the UCWA server."); tc.TrackEvent("CreateUcwaApps-Failed"); Console.WriteLine("Failed to create application on the UCWA server."); } return(createUcwaAppsResults); } catch (Exception ex) { tc.TrackException(ex); tc.TrackEvent("CreateUcwaApps-Exception"); Console.WriteLine("Failed to create application on the UCWA server."); throw new CustomException("Error occured in " + MethodBase.GetCurrentMethod().Name + ":" + ex.Message + " TargetSite:" + ex.TargetSite + " StackTrace: " + ex.StackTrace); } }
public string GetAbsoluteUrl(string url) { // If this is just a path then add in the scheme, host, port and application path. if (url.Length > 0) { switch (url[0]) { case Url.PathSeparatorChar: return(Root.AddUrlSegments(url)); case ApplicationPathStartChar: return(ApplicationRoot.AddUrlSegments(url.Substring(1))); } } return(url); }
public async Task GetIM_Step01_Application(HttpClient httpClient, TelemetryClient tc) { try { httpClient.DefaultRequestHeaders.Remove("Accept"); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", UCWAConfiguration.authToken.access_token); httpClient.DefaultRequestHeaders.Add("Accept", "application/json"); string url_00 = DI._config.GetSection("UCWA:ucwa_applications_host").Value + UCWAConfiguration.ucwaApplication;// + ConfigData.ucwaPeopleContact; var res_00 = await httpClient.GetAsync(url_00); string res_00_request = res_00.RequestMessage.ToString(); string res_00_headers = res_00.Headers.ToString(); string res_00_status = res_00.StatusCode.ToString(); var res_00_content = await res_00.Content.ReadAsStringAsync(); if (res_00_status == "OK") { ApplicationRoot obj = new ApplicationRoot(); JsonConvert.PopulateObject(res_00_content, obj); if (obj != null) { UCWAConfiguration.ucwaApplication = obj._links.self.href; UCWAConfiguration.ucwaEvents = obj._links.events.href; } //GetIM_Step02_Contact(httpClient); GetIM_Step03_Events(httpClient, tc); } else { //ConfigData.Log("2", String.Format(">> GetIM ended abnormally. {0}", "STEP01")); } } catch (Exception ex) { tc.TrackException(ex); throw new CustomException("Error occured in " + MethodBase.GetCurrentMethod().Name + ":" + ex.Message + " TargetSite:" + ex.TargetSite + " StackTrace: " + ex.StackTrace); } }
private void btnStart_Click(object sender, EventArgs e) { try { root = ApplicationRoot.Singleton; root.CoreLoaded += Root_CoreLoaded; new MainFactory().Make(root, txtToolModel.Text, true); btnStart.Enabled = false; btnStart2.Enabled = false; } catch (Exception ex) { Console.WriteLine("Failed to Start - {0}", ex); if (root != null) { root.CoreLoaded -= Root_CoreLoaded; } ApplicationRoot.Reset(); } }
private void btnStart2_Click(object sender, EventArgs e) { try { root = ApplicationRoot.Singleton; root.CoreLoaded += Root_CoreLoaded; new MainFactory().Make(root, @"C:\Personal\Projects\EIB\HellerEIB\HellerEIB_TEST.xml", true); ecsServerNameTextBox.Text = "ECSInterface_Oven"; btnStart.Enabled = false; btnStart2.Enabled = false; } catch (Exception ex) { Console.WriteLine("Failed to Start - {0}", ex); if (root != null) { root.CoreLoaded -= Root_CoreLoaded; } ApplicationRoot.Reset(); } }
public static string CreateUcwaApps(HttpClient httpClient, AuthenticationResult ucwaAuthenticationResult, string ucwaApplicationsRootUri, UcwaMyAppsObject ucwaAppsObject) { string createUcwaAppsResults = string.Empty; httpClient.DefaultRequestHeaders.Clear(); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ucwaAuthenticationResult.AccessToken); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var createUcwaPostData = JsonConvert.SerializeObject(ucwaAppsObject); Console.WriteLine("CreateUcwaApps POST data is " + createUcwaPostData); var httpResponseMessage = httpClient.PostAsync(ucwaApplicationsRootUri, new StringContent(createUcwaPostData, Encoding.UTF8, "application/json")).Result; Console.WriteLine("CreateUcwaApps response is " + httpResponseMessage.Content.ReadAsStringAsync().Result); if (httpResponseMessage.IsSuccessStatusCode) { createUcwaAppsResults = httpResponseMessage.Content.ReadAsStringAsync().Result; ApplicationRoot obj = new ApplicationRoot(); JsonConvert.PopulateObject(createUcwaAppsResults, obj); if (obj != null) { ConfigData.ucwaApplication = obj._links.self.href; // ConfigData.ucwaApplications += ConfigData.ucwaApplication; ConfigData.ucwaEvents = obj._links.events.href; } // switch (xml02.GetAttribute("rel")) // case "application":ucwaApplication // case "me": ConfigData.ucwaMe)); // case "events":ConfigData.ucwaEvents)); // case "makeMeAvailable":ConfigData.ucwaMakeMeAvailable)); // case "startMessaging":ConfigData.ucwaMessagingInvitations)); // case "startPhoneAudio": ConfigData.ucwaStartPhoneAudio)); } return(createUcwaAppsResults); }
public void can_create_new_clientapplication() { var application = new ApplicationRoot( _id, Application, OneRolePerUser, _roles, SecAdminRole, DefaultUser, DefaultDomain, _defaultUserRoles, _command); var events = application.TakeEvents(); Assert.Collection( events, e => { if (e is ApplicationMsgs.ApplicationRegistered created) { Assert.Equal(_id, created.Id); Assert.Equal(Application, created.Name); Assert.Equal(OneRolePerUser, created.OneRolePerUser); Assert.Equal(_roles, created.Roles); Assert.Equal(SecAdminRole, created.SecAdminRole); Assert.Equal(DefaultUser, created.DefaultUser); Assert.Equal(DefaultDomain, created.DefaultDomain); Assert.Equal(_defaultUserRoles, created.DefaultUserRoles); } else { throw new Exception("wrong event."); } }); }