public async Task GetStringAsync_should_return_the_text() { // // Arrange. // const string TextToTest = "this is a text book"; Mock <IHttpClientWrapper> mockHttpClient = new Mock <IHttpClientWrapper>(); HttpResponseMessage mockResponse = new HttpResponseMessage(); mockResponse.Content = new StringContent(TextToTest); IWebApiProcessor processor = new WebApiProcessor(mockHttpClient.Object); processor.ApiPath = "someApiPath"; processor.WebLocation = "ServerName"; string webPath = string.Format("{0}{1}", processor.WebLocation, processor.ApiPath); mockHttpClient.Setup(x => x.GetAsync(webPath)).Returns(Task.FromResult(mockResponse)); // // Act. // string text = await processor.GetStringAsync(); // // Assert. // Assert.AreEqual(text, TextToTest); }
private Task <ClubModel> GetSingleResult(string method) { return(WebApiProcessor <ClubModel> .GetSingle(method)); }
private Task <List <ClubModel> > GetResult(string method) { return(WebApiProcessor <ClubModel> .Get(method)); }
public MainClub() { InitializeComponent(); webApiProcessor = new WebApiProcessor <ClubModel>(); }
private Task <List <ScheduleModule> > GetResult(string method) { return(WebApiProcessor <ScheduleModule> .Get(method)); }