public async void Test_Txt_Request() { var url = "https://dexih.dataexpertsgroup.com"; var httpRequest = new HttpClient(); await httpRequest.GetAsync($"{url}/api/Remote/AddTxtRecord"); var requestResolver = new RequestResolver(null, new DefaultHttpClientFactory(), RootAddress, new [] { "20.20.20.20" }, "dexih.com", "*****@*****.**", 123, 60, $"{url}/api/Remote/GetTxtRecords"); var domain = new Domain("dexih.com"); var question = new Question(domain, RecordType.TXT, RecordClass.IN); var request = new Request(new Header(), new List <Question>() { question }, new List <IResourceRecord>()); var resolve = await requestResolver.Resolve(request); var txtRecord = resolve.AnswerRecords.Where(c => c.Type == RecordType.TXT); Assert.True(txtRecord.Any()); var value = Encoding.Default.GetString(txtRecord.First().Data).Substring(1); Assert.Equal("test0=sample value", value); }
public async void HandleRequest(string data) { Log("Request: "); Log(data); string response = _requestResolver.Resolve(data); Log("Response: "); Log(response); await SendAsync(response); }
public void Test_Dynamic_A_Request() { var requestResolver = new RequestResolver(null, null, RootAddress, new [] { "20.20.20.20" }, "dexih.com", "*****@*****.**", 123, 60, "abc"); var question = new Question(new Domain("127-0-0-1.abc.dexih.com"), RecordType.A, RecordClass.IN); var request = new Request(new Header(), new List <Question>() { question }, new List <IResourceRecord>()); var resolve = requestResolver.Resolve(request).Result; Assert.Equal(1, resolve.AnswerRecords.Count); Assert.IsType <IPAddressResourceRecord>(resolve.AnswerRecords[0]); var record = (IPAddressResourceRecord)resolve.AnswerRecords[0]; Assert.Equal("127.0.0.1", record.IPAddress.ToString()); }
public bool MakeRequest(params object[] requestParams) { return(resolver.Resolve(new ParamsObject(requestParams))); }