/// <summary> /// Function To Get User Data Source Names /// </summary> public bool GetUserDataSourceNames() { bool isTrue = false; foreach (string GetKey in listAllDSN().GetKeyList()) { if (GetKey.Contains("TallyODBC")) { try { odbcCon = new OdbcConnection("Dsn=" + GetKey + ""); if (odbcCon.State == System.Data.ConnectionState.Closed) { odbcCon.Open(); } OdbcDataAdapter odbcCom = new OdbcDataAdapter("SELECT `$PriceLevel` FROM PriceLevels", odbcCon); if (odbcCom != null) { odbcCom.Fill(new DataTable()); odbcCon.Close(); strODBCConnectionString = odbcCon.ConnectionString; isTrue = true; break; } } catch (Exception) { continue; } } } return(isTrue); }
public override void Update(float ticks = 0) { if (GetKey.Down(KEY_TYPE.SPACE)) { SceneManager.I.ChangeScene(SCENE_NAME.LOBBY_SCENE); } }
/// <summary>AddAsNode a new index to the cache</summary> /// <typeparam name="TKey">the type of the key value</typeparam> /// <param name="indexName">the name to be associated with this list</param> /// <param name="getKey">delegate to get key from object</param> /// <param name="item">delegate to load object if it is not found in index</param> /// <returns>the newly created index</returns> public IIndex <TKey, T> AddIndex <TKey>(string indexName, GetKey <T, TKey> getKey, ItemLoader <TKey, T> item = null) { var index = new Index <TKey, T>(this, Capacity, lifeSpan, getKey, item); indexList[indexName] = index; return(index); }
public override void Update(float ticks = 0) { if (GetKey.Down(KEY_TYPE.SPACE)) { _isEndScene = true; } }
public static IRestResponse SendMessage(IList <User> MailList, Report report, String City) { // Setup RestClient client = new RestClient(); client.BaseUrl = new Uri("https://api.eu.mailgun.net/v3/"); client.Authenticator = new HttpBasicAuthenticator("api", GetKey.MailgunAPIKey()); // Create To list string ToField = ""; foreach (User u in MailList) { ToField += u.EmailAddress + ", "; } // Create Message string text = WriteMessage(report, City); // Domain string DomainName = "helpinghandni.tech"; // The Request RestRequest request = new RestRequest(); request.AddParameter("domain", DomainName, ParameterType.UrlSegment); request.Resource = "{domain}/messages"; request.AddParameter("from", "HelpingHand Developer <mailgun@" + DomainName + ">"); request.AddParameter("to", ToField); request.AddParameter("subject", "New Homeless Report in your City!"); request.AddParameter("text", text); request.Method = Method.POST; return(client.Execute(request)); }
private TraceGroupsReport <T> CreateDictionary <T>(GetKey <T> getKey) { TraceGroupsReport <T> ret = new TraceGroupsReport <T>(); foreach (SqlStatementCounters counter in this) { T key = getKey(counter); SqlGroupCounters <T> value; if (!ret.TryGetValue(key, out value)) { value = new SqlGroupCounters <T>(); value.Count = 1; value.Group = key; value.Counters = counter.Counters; ret[key] = value; } else { value.Count++; value.Counters = value.Counters + counter.Counters; } } return(ret); }
public override void Execute(int globalCooldown) { if (_globalCooldown == null) { _globalCooldown = new Ticker(globalCooldown); } if (_times > 0) { int i = _times; while (i > 0) { GetKey.SendKey(); _globalCooldown.Reset(); while (ObjectManager.MyPlayer.IsCasting || !_globalCooldown.IsReady) { Thread.Sleep(10); } i--; } } else { if (ObjectManager.MyPlayer.IsValid && !ObjectManager.MyPlayer.IsMe) { ObjectManager.MyPlayer.Target.Face(); } GetKey.SendKey(); while (ObjectManager.MyPlayer.IsCasting || !_globalCooldown.IsReady) { Thread.Sleep(10); } } }
public override void Update(float ticks = 0) { if (GetKey.Down(KEY_TYPE.SPACE)) { CreateBomb(); } Move(ticks); }
public Boolean Decreypt(string encrypt, int ID) { //Get Public File GetKey objKey = new GetKey(); DataRow drKey = objKey.drSearchStudentKey(ID); string PublicKey1 = drKey[0].ToString(); // obtain an OpenPGP signed message String signedString = encrypt; // Extract the message and check the validity of the signature String plainText; // create an instance of the library PGPLib pgp = new PGPLib(); SignatureCheckResult signatureCheck; try { signatureCheck = pgp.VerifyString(signedString, new FileInfo(PublicKey1), out plainText); } catch { return(false); } string strData1 = plainText; // Print the results Console.WriteLine("Extracted plain text message is " + plainText); if (signatureCheck == SignatureCheckResult.SignatureVerified) { // Console.WriteLine("Signature OK"); return(true); } else if (signatureCheck == SignatureCheckResult.SignatureBroken) { //Console.WriteLine("Signature of the message is either broken or forged"); return(false); } else if (signatureCheck == SignatureCheckResult.PublicKeyNotMatching) { // Console.WriteLine("The provided public key doesn't match the signature"); return(false); } else if (signatureCheck == SignatureCheckResult.NoSignatureFound) { // Console.WriteLine("This message is not digitally signed"); return(false); } return(false); }
public static bool AreEqual <T>(IEnumerable <T> l, IEnumerable <T> r, GetKey <T> getKey) { if (!ListsRoughlyEqual(l, r)) { return(false); } if (l == null || r == null) { return(true); } if (getKey == null) { int count = 0; foreach (var i in l) { foreach (var j in r) { if (object.Equals(i, j)) { ++count; break; } } } return(count == l.Count()); } Dictionary <int, T> lookup = new Dictionary <int, T>(); foreach (var v in l) { lookup[getKey(v)] = v; } foreach (var v in r) { if (!lookup.TryGetValue(getKey(v), out var found)) { //Log.Error("Not Found"); return(false); } if (!v.Equals(found)) { //Log.Error("Not Equal"); return(false); } } lookup.Clear(); lookup = null; return(true); }
/// <summary>Adds a new index to the cache</summary> /// <typeparam name="TKey">the type of the key value</typeparam> /// <param name="indexName">the name to be associated with this list</param> /// <param name="getKey">delegate to get key from object</param> /// <param name="item">delegate to load object if it is not found in index</param> /// <param name="keyEqualityComparer">The equality comparer to be used to compare the keys. Optional.</param> /// <returns>the newly created index</returns> public IIndex <TKey, T> AddIndex <TKey>( string indexName, GetKey <T, TKey> getKey, ItemCreator <TKey, T> item = null, IEqualityComparer <TKey> keyEqualityComparer = null) { var index = new Index <TKey, T>(this, lifeSpan, getKey, item, keyEqualityComparer); indexList[indexName] = index; return(index); }
// Get /ViewReport/{ID} public IActionResult ViewReport(int Id) { var Report = _svc.GetById(Id); if (Report == null) { return(NotFound()); } TempData["MapsAPIKey"] = GetKey.GoogleAPIKey(); return(View(Report)); }
/// <summary>constructor</summary> /// <param name="owner">parent of index</param> /// <param name="lifespanManager"></param> /// <param name="getKey">delegate to get key from object</param> /// <param name="loadItem">delegate to load object if it is not found in index</param> public Index(FluidCache <T> owner, int capacity, LifespanManager <T> lifespanManager, GetKey <T, TKey> getKey, ItemLoader <TKey, T> loadItem) { Debug.Assert(owner != null, "owner argument required"); Debug.Assert(getKey != null, "GetKey delegate required"); this.owner = owner; this.lifespanManager = lifespanManager; index = new Dictionary <TKey, WeakReference>(capacity * 2); _getKey = getKey; this.loadItem = loadItem; RebuildIndex(); }
// Get /Report/{ID}/ConfirmDelete public IActionResult Delete(int Id) { var Report = _svc.GetById(Id); if (Report == null) { Alert("Report Not Found", AlertType.warning); return(RedirectToAction("ViewReports", "Report")); } TempData["MapsAPIKey"] = GetKey.GoogleAPIKey(); Alert("Report will Be permanently deleted, are you sure?", AlertType.danger); return(View(Report)); }
public IActionResult Create() { var rvm = new ReportViewModel() { GoogleAPIKey = GetKey.GoogleAPIKey(), /* While not the most elegent fix, the view models lat & long * must be above 90 to ensure that you cannot submit blank reports. * This is due to doubles being non-nullable */ Latitude = 999, Longitude = 999 }; return(View(rvm)); }
/// <summary>constructor</summary> /// <param name="owner">parent of index</param> /// <param name="lifespanManager"></param> /// <param name="getKey">delegate to get key from object</param> /// <param name="loadItem">delegate to load object if it is not found in index</param> /// <param name="keyEqualityComparer">The equality comparer to be used to compare the keys. Optional.</param> public Index( FluidCache <T> owner, LifespanManager <T> lifespanManager, GetKey <T, TKey> getKey, ItemCreator <TKey, T> loadItem, IEqualityComparer <TKey> keyEqualityComparer) { Debug.Assert(owner != null, "owner argument required"); Debug.Assert(getKey != null, "GetKey delegate required"); this.owner = owner; this.lifespanManager = lifespanManager; _getKey = getKey; this.loadItem = loadItem; this.keyEqualityComparer = keyEqualityComparer; RebuildIndex(); }
void Update() { var keys = GetKey.GetCurrentKeysDown(); if (keys == null) { return; } foreach (var key in keys) { input.SetKey(activeBinding, key); } display.Refresh(); }
protected void btnSave_Click(object sender, EventArgs e) { int ID = Convert.ToInt32(Session["ID"].ToString()); string password = txtPassword.Text.ToString(); string Email = labEmail.Text.ToString(); SignatureEmployee objj = new SignatureEmployee(); objj.CreateSignature(password, Email, ID); string pathPub = System.Web.HttpContext.Current.Server.MapPath("../PageEmployee/Sig") + "/" + ID + ".asc"; string PrivateKey = "Sig/" + ID + "pr" + ".asc"; GetKey objKey = new GetKey(); objKey.AddKeyEmployee(pathPub, ID); downloadfile(PrivateKey); }
protected void btnSave_Click(object sender, EventArgs e) { int ID = Convert.ToInt32(Request.QueryString["id"]); string password = txtPassword.Text.ToString(); string Email = labEmail.Text.ToString(); SignatureStudents objj = new SignatureStudents(); objj.CreateSignature(password, Email, ID); string pathPub = System.Web.HttpContext.Current.Server.MapPath("../PageStudents/Sig") + "/" + ID + ".asc"; string PrivateKey = "Sig/" + ID + "pr" + ".asc"; GetKey objKey = new GetKey(); objKey.AddKeyStudent(pathPub, ID); downloadfile(PrivateKey); }
} // TaskManager() //讀取xml檔轉成Task物件 public Task ReadXml(string TaskName) { Debug.Log(TaskName); Task t = new Task(); XElement xe = xmlDoc.Root.Element(TaskName); int DiaID = Convert.ToInt32(xe.Element("DiaID").Value); int TaskID = Convert.ToInt32(xe.Element("TaskID").Value); int GetDiaID = Convert.ToInt32(xe.Element("GetDiaID").Value); t.name = xe.Element("Name").Value; t.content = xe.Element("Content").Value; IEnumerable <XElement> tc = xe.Elements("TaskCondition"); IEnumerable <XElement> keyname = xe.Elements("KeyName"); IEnumerable <XElement> ObjName = xe.Elements("ObjectName"); Debug.Log(TaskName + " " + t.name + " " + t.content); // IEnumerable<XElement> **** t.TaskID = TaskID; int k_i = 0; // GetKey Index int c_i = 0; // ClickObj Index foreach (XElement temp in tc) { if (temp.Value == "GetKey") { GetKey get_key = new GetKey(TaskID, keyname.ElementAt <XElement>(k_i).Value.ToString()); // Debug.Log(get_key.KeyName); t.tc.Add(get_key); k_i++; } // if if (temp.Value == "ClickObject") { ClickObject clickObj = new ClickObject(TaskID, ObjName.ElementAt <XElement>(c_i).Value.ToString()); // Debug.Log(clickObj.ObjectName); t.tc.Add(clickObj); c_i++; } // if } // foreach // Debug.Log("Task" + t.TaskID + " " + t.name); return(t); } // ReadXml()
public MultiLineKeyedGraphModelType( string title, string subTitle, Encoding xEncoding, Encoding yEncoding, GetXFromInstance <INSTANCE> getX, GetYFromInstance <INSTANCE> getY, GetKey <INSTANCE, KEY> getKey, GetLabel <KEY> getLabel) : base( title, subTitle, xEncoding, yEncoding, getX, getY) { this.getKey = getKey; this.getLabel = getLabel; }
public async void EmailService_SendMessage_CheckedWithTestMail() { // Given client.BaseAddress = new Uri("https://api.testmail.app/api/json"); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); var Query = client.BaseAddress + "?apikey=" + GetKey.TestmailAPIKey() + "&namespace=9h5an"; TestMailResponse EmailResponse = null; // when var Return = EmailService.SendMessage(MaiList, report, City); HttpResponseMessage response = await client.GetAsync(Query); if (response.IsSuccessStatusCode) { EmailResponse = await response.Content.ReadAsAsync <TestMailResponse>(); } string ExpectedMessage = "A new Report has been created in TestCity. The Three word address of the report is: Test.Email.Service. To view on a map open:\n https://what3words.com/Test.Email.Service\n This report was created at 01/01/0001 00:00:00, and the following was the additional information provided: Test Info\n\n Thank you! \n This message was auto-generated by HelpingHand & sent via MailGun. \nIf you want to stop recieving these messages, please turn off notifications in your account settings.\n"; bool EmailFound = false; for (int i = 0; i < EmailResponse.emails.Length; i++) { var Email = EmailResponse.emails[i]; if (Email.text == ExpectedMessage) { EmailFound = true; } } // Then Assert.IsType <RestResponse>(Return); Assert.True(response.IsSuccessStatusCode); Assert.True(EmailFound); }
public static string GET(string key) { HttpContext Http = HttpContext.Current; foreach (string GetKey in Http.Request.QueryString.AllKeys) { try { if (GetKey.Split('?')[1] == key) { return(Http.Request.QueryString[GetKey]); } } catch { } } if (Http.Request.QueryString[key] != null) { return(Http.Request.QueryString[key]); } else { string[] urlparams = Http.Request.RawUrl.Split('/'); foreach (string urlparam in urlparams) { string[] urlparamarr = urlparam.Split('-'); if (urlparamarr.Length >= 2 && urlparamarr[0] == key) { return(String.Join("-", urlparamarr, 1, (urlparamarr.Length - 1))); } else if (urlparamarr.Length == 1 && urlparamarr[0] == key) { return("true"); } } return(""); } }
private async Task <bool> Query(ID7Client client, string subUrl, CancellationToken tkn) { Debug_n($"Querying repository of ‹{ClsTyp}›...", subUrl); List <TNodeDto> dtos; try { dtos = await client.Get <List <TNodeDto> >(subUrl, tkn); } catch (Exception ex) { return(Error_n("Query error:", ex.Details(false, false))); } if (dtos == null) { return(false); } var tmp = dtos.Select(x => FromDto(x)); if (!AreKeysUnique(tmp)) { return(Warn_n($"‹{ClsTyp}› Keys are not unique.", GetKey.ToString())); } _list = tmp.ToList(); if (_list.Count == 1 && _list[0] == null) { _list.Clear(); } StartTrackingChanges(); return(true); }
public static object CallTBMA(string instrumentid, string setdate, double yield, double cprice, string ytype, bool y2p) { try { MA_TBMA_CONFIG config = LookupUIP.GetTBMAConfig(SessionInfo); string username, userpassword, token, Key, ErrorMessage; username = config.TBMA_CAL_USERNAME; userpassword = config.TBMA_CAL_PASSWORD; MA_INSTRUMENT ins = InstrumentUIP.GetByID(SessionInfo, new Guid(instrumentid)); if (ins == null) { throw new Exception("Instrument is not found"); } LoggingHelper.Info("TBMA Calculation Service has been called by " + SessionInfo.UserLogon); //Step 1 Create new instant object ThaiBMACalc.ThaiBMA_Claculation_Service calc = new ThaiBMACalc.ThaiBMA_Claculation_Service(); //Service Object ThaiBMACalc.BondFactor BF = new ThaiBMACalc.BondFactor(); //input object ThaiBMACalc.AuthenHeader header = new ThaiBMACalc.AuthenHeader(); //authen object //Step 2 Get token Authen.ThaiBMA_Calculation_Auth authen = new Authen.ThaiBMA_Calculation_Auth(); token = authen.GetToken(username); //Step 3 Get Key for access Key = GetKey.getKeyLogin(token, username, userpassword); header.key = Key; header.username = username; //Step 4 Set auhen value calc.AuthenHeaderValue = header; //Step 5 Set input value to object BF.Symbol = ins.LABEL; BF.SettlementDate = DateTime.ParseExact(setdate, "dd/MM/yyyy", null); BF.TradeDateAndTime = System.DateTime.Now; BF.Yield = yield; BF.Percent_Price = cprice; BF.isYield2Price = y2p; BF.isCallPutOption = false; BF.Unit = 1; BF.PriceType = ThaiBMACalc.PriceType.Clean; if (ins.LABEL.StartsWith("ILB")) { BF.isILB = true; } if (ytype == "DM") { BF.YieldType = ThaiBMACalc.YieldType.DM; } else { BF.YieldType = ThaiBMACalc.YieldType.YTM; } //Step 6 Call calc method ThaiBMACalc.CalculationOutput result = calc.BondCalculation(BF); ThaiBMACalc.ServiceError sresult = (ThaiBMACalc.ServiceError)result.ServiceResult; //Error while calling service if (sresult != null && !sresult.Result) { ErrorMessage = sresult.ErrorMessage; string ErrorNo = sresult.ErrorNo; bool rtn = sresult.Result; string attime = sresult.TimeStamp.ToString(); LoggingHelper.Error("ThaiBMA service is fail. " + ErrorMessage); return(new { Result = "ERROR", Message = "ThaiBMA service is fail. " + ErrorMessage }); } if ((result.CalcError == null) && (result.CalcResult != null)) { ThaiBMACalc.CalcResult myResult = (ThaiBMACalc.CalcResult)result.CalcResult; //Calculation Result double RGrossPrice = 0; double RCleanPrice = 0; double RYield = 0; if (myResult.Symbol.StartsWith("ILB")) { RCleanPrice = (double)myResult.Percent_Unadjusted_CleanPrice; RYield = (double)myResult.Percent_RealYield; RGrossPrice = (double)myResult.Percent_Unadjusted_GrossPrice; } else { RYield = ytype == "DM" ? (double)myResult.Percent_DM : (double)myResult.Percent_Yield; RCleanPrice = (double)myResult.Percent_CleanPrice; RGrossPrice = (double)myResult.Percent_GrossPrice; } return(new { Result = "OK", gprice = RGrossPrice, cprice = RCleanPrice, yield = RYield }); //.... and more } else { Type error = result.CalcError.GetType(); IList <PropertyInfo> props = new List <PropertyInfo>(error.GetProperties()); string errmsg = string.Join(",", props.Where(p => p.GetValue(result.CalcError, null).ToString() != "").Select(p => p.GetValue(result.CalcError, null)).ToList()); LoggingHelper.Error("ThaiBMA Caculation is fail. " + errmsg); return(new { Result = "ERROR", Message = "ThaiBMA Caculation is fail. " + errmsg }); } } catch (Exception ex) { LoggingHelper.Error("ThaiBMA service is fail. " + ex.Message); return(new { Result = "ERROR", Message = ex.Message }); } }
public BinarySearchTree(BinarySearchTreeNode <T> rtnd, GetKey gkey) { _rtnd = rtnd; _gkey = gkey; }
public void Move(float ticks) { if (GetKey.Press(KEY_TYPE.UP)) { _direction = DIRECTION.UP; } else if (GetKey.Press(KEY_TYPE.DOWN)) { _direction = DIRECTION.DOWN; } else if (GetKey.Press(KEY_TYPE.LEFT)) { _direction = DIRECTION.LEFT; } else if (GetKey.Press(KEY_TYPE.RIGHT)) { _direction = DIRECTION.RIGHT; } if (GetKey.State() == KEY_STATE.UN_PRESS) { _direction = DIRECTION.NONE; return; } for (int i = 0; i < MapObjectManager.I.GetObjectList(MAPOBJECT_TYPE.OBSTACLE).Count; i++) { Vector2 tempPos = _transform.Position; if (_direction == DIRECTION.RIGHT) { tempPos = new Vector2(tempPos.X + 2, tempPos.Y); } else if (_direction == DIRECTION.LEFT) { tempPos = new Vector2(tempPos.X - 2, tempPos.Y); } else if (_direction == DIRECTION.UP) { tempPos = new Vector2(tempPos.X, tempPos.Y - 1); } else if (_direction == DIRECTION.DOWN) { tempPos = new Vector2(tempPos.X, tempPos.Y + 1); } if (tempPos == MapObjectManager.I.GetObjectList(MAPOBJECT_TYPE.OBSTACLE)[i].Transfrom.Position) { StopMove(); return; } } if (_rideType != RIDE_TYPE.STAR) { for (int i = 0; i < MapObjectManager.I.GetObjectList(MAPOBJECT_TYPE.BREAK_OBSTACLE).Count; i++) { Vector2 tempPos = _transform.Position; if (_direction == DIRECTION.RIGHT) { tempPos = new Vector2(tempPos.X + 2, tempPos.Y); } else if (_direction == DIRECTION.LEFT) { tempPos = new Vector2(tempPos.X - 2, tempPos.Y); } else if (_direction == DIRECTION.UP) { tempPos = new Vector2(tempPos.X, tempPos.Y - 1); } else if (_direction == DIRECTION.DOWN) { tempPos = new Vector2(tempPos.X, tempPos.Y + 1); } if (tempPos == MapObjectManager.I.GetObjectList(MAPOBJECT_TYPE.BREAK_OBSTACLE)[i].Transfrom.Position) { Kick(MapObjectManager.I.GetObjectList(MAPOBJECT_TYPE.BREAK_OBSTACLE)[i]); StopMove(); return; } } } if (_direction != DIRECTION.NONE) { if (_rideType == RIDE_TYPE.NULL) { _tempPosition += (GameManager.I().DicDirection[_direction] * GameStat.MoveSpeed * ticks); } else { _tempPosition += (GameManager.I().DicDirection[_direction] * _rideStat.MoveSpeed * ticks); } if (Math.Abs(_tempPosition.X - _transform.Position.X) >= 2.0f) { _transform.Position.X = (int)Math.Round(_tempPosition.X); } if (Math.Abs(_tempPosition.Y - _transform.Position.Y) >= 1.0f) { _transform.Position.Y = (int)Math.Round(_tempPosition.Y); } } }
public RestService(HttpClient client) { this.client = client; this.baseQuery = client.BaseAddress + "convert-to-3wa?key=" + GetKey.What3WordsAPIKey() + "&language=en&format=json"; }
public BinarySearchTree(GetKey gkey) : this(null, gkey) { }
public async void Integration_CreateAReport_Success() { /* Given */ _ReportController.TempData = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>()); // User Accounts Added By Seed _Seeder.Seed(); /* When */ // Open New Report Page var CreatePage = _ReportController.Create(); Assert.IsType <ViewResult>(CreatePage); // Fill ViewModel var FilledViewModel = new ReportViewModel() { Latitude = 54.717805, Longitude = -6.226443, AdditionalInfo = "Report from Antrim Castle Gardens", }; // Submit var Result = (RedirectToActionResult)await _ReportController.Create(FilledViewModel); // Then Assert.Equal("Home", Result.ControllerName); Assert.Equal("Index", Result.ActionName); // Controller Calls Service, Service Should Get 3 Word Address // Should Add To Database, and have Created at time var CreatedReport = _db.Reports.FirstOrDefault(r => (r.Latitude == 54.717805) && (r.Longitude == -6.226443)); Assert.NotNull(CreatedReport); Assert.NotNull(CreatedReport.ThreeWordAddress); Assert.Equal("cares.sand.pacifist", CreatedReport.ThreeWordAddress); Assert.Equal(DateTime.Now, CreatedReport.CreatedAt, TimeSpan.FromSeconds(10.00)); // Should Call Notify Function var client = new HttpClient(); client.BaseAddress = new Uri("https://api.testmail.app/api/json"); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); var Query = client.BaseAddress + "?apikey=" + GetKey.TestmailAPIKey() + "&namespace=9h5an"; TestMailResponse EmailResponse = null; HttpResponseMessage response = await client.GetAsync(Query); if (response.IsSuccessStatusCode) { EmailResponse = await response.Content.ReadAsAsync <TestMailResponse>(); } string ExpectedMessage = "A new Report has been created in Non-City Area. The Three word" + " address of the report is: cares.sand.pacifist. To view on a map" + " open:\n https://what3words.com/cares.sand.pacifist\n This" + " report was created at " + DateTime.Now.ToString() + ", and the following" + " was the additional information provided: Report from Antrim" + " Castle Gardens\n\n Thank you! \n This message was auto-" + "generated by HelpingHand & sent via MailGun. \nIf you want to" + " stop recieving these messages, please turn off notifications" + " in your account settings.\n"; // Pattern Below Matches Return Strings using RegEx to ignore the // Time as this varies from report being sent to now. var input = ExpectedMessage; string pattern = @"\d+[/]\d+[/]\d+\s\d+[:]\d+[:]\d+"; String[] ExpectedElements = System.Text.RegularExpressions.Regex.Split(ExpectedMessage, pattern); bool EmailFound = false; for (int i = 0; i < EmailResponse.emails.Length && !EmailFound; i++) { var Email = EmailResponse.emails[i]; String[] ReturnedElements = System.Text.RegularExpressions.Regex.Split(Email.text, pattern); if ((ExpectedElements[0] == ReturnedElements[0]) && (ExpectedElements[1] == ReturnedElements[1])) { EmailFound = true; } } // Then Assert.True(EmailFound); }