public async Task TestSimpleDeleteFunctionAsync() { var dynamicHttpEndpoint = new DynamicHttpEndpoint(_httpClientMock.Object, typeof(ITestEndpoint)).ActLike <ITestEndpoint>(); _httpClientMock.Setup(setup => setup.DeleteRequestAsync(It.IsAny <string>())).Returns(Task.CompletedTask).Verifiable(); await dynamicHttpEndpoint.Delete(); _httpClientMock.Verify(x => x.DeleteRequestAsync("Test"), Times.Once); }
public async Task TestWithSimpleQueryAsync() { var dynamicHttpEndpoint = new DynamicHttpEndpoint(_httpClientMock.Object, typeof(ITestEndpoint)).ActLike <ITestEndpoint>(); _httpClientMock.Setup(setup => setup.GetRequestAsync <object>(It.IsAny <string>())).ReturnsAsync(null).Verifiable(); await dynamicHttpEndpoint.Get(5); _httpClientMock.Verify(x => x.GetRequestAsync <object>("Test?number=5"), Times.Once); }
public async Task TestSimplePostFunctionAsync() { var dynamicHttpEndpoint = new DynamicHttpEndpoint(_httpClientMock.Object, typeof(ITestEndpoint)).ActLike <ITestEndpoint>(); _httpClientMock.Setup(setup => setup.PostRequestAsync <object, object>(It.IsAny <string>(), It.IsAny <object>())).ReturnsAsync(null).Verifiable(); var obj = "emptyObject"; await dynamicHttpEndpoint.Post(obj); _httpClientMock.Verify(x => x.PostRequestAsync <object, object>("Test", obj), Times.Once); }