protected internal PagedResponse( string url, SimbaBase simba) { _url = url; _simba = simba; }
/// <summary> /// Retreive a new instance of SimbaBase correct for the API url /// </summary> public async Task InitSimba() { Simba = await SimbaBase.GetSimbaInstance( "https://api.simbachain.com/v1/libSimba-SimbaChat-Quorum/", Wallet, "04d1729f7144873851a745d2ae85639f55c8e3de5aea626a2bcd0055c01ba6fc"); }
public async Task GetSimbaInstanceReturnsCorrectType(string url, bool throws, bool isNull, Type reType) { var client = new HttpClient(new HttpMessageHandlerStub(async(request, cancellationToken) => { if (request.RequestUri.AbsoluteUri == "https://api.simbachain.com/v1/libSimba-SimbaChat-Quorum/?format=openapi") { var responseMessage = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(Resources.simbachat_swagger_json), Headers = { { HttpResponseHeader.ContentType.ToString(), "application/json" } } }; return(await Task.FromResult(responseMessage)); } else { var responseMessage = new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent("Not Found") }; return(await Task.FromResult(responseMessage)); } })); try { SimbaBase.Client = client; var simba = await SimbaBase.GetSimbaInstance(url); if (simba == null) { Assert.True(isNull); } else { Assert.False(isNull); Assert.False(throws); Assert.NotNull(simba); if (reType == typeof(SimbaChain)) { Assert.IsAssignableFrom <SimbaChain>(simba); } } } catch (Exception e) { Assert.True(throws); Assert.IsAssignableFrom <MissingMetadataException>(e); } }
public async Task SimbaInstance() { var client = new HttpClient(new HttpMessageHandlerStub(async(request, cancellationToken) => { if (request.RequestUri.AbsoluteUri == "https://api.simbachain.com/v1/libSimba-SimbaChat-Quorum/?format=openapi") { var responseMessage = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(Resources.simbachat_swagger_json), Headers = { { HttpResponseHeader.ContentType.ToString(), "application/json" } } }; return(await Task.FromResult(responseMessage)); } else { var responseMessage = new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent("Not Found") }; return(await Task.FromResult(responseMessage)); } })); SimbaBase.Client = client; var simba = await SimbaBase.GetSimbaInstance("https://api.simbachain.com/v1/libSimba-SimbaChat-Quorum/"); Assert.IsAssignableFrom <SimbaBase>(simba); Assert.IsAssignableFrom <SimbaChain>(simba); }