public static void Execute() { // change these values to your API login var user = "******"; var password = "******"; var url = "http://weblaunch.blifax.com/postapi"; var client = new ApiClient(url, user, password); var response = client.GetLists(ReportReturnType.XML); Console.WriteLine(response); response = client.GetLists(ReportReturnType.CSV); Console.WriteLine("\n\n"+ response); }
public void CallsFailWithoutInit01Test() { ApiClient apiClient = new ApiClient(); try { apiClient.GetLists(ReportReturnType.CSV); } catch (ApplicationException ae) { Assert.AreEqual("APIClient.Initialized must be called prior to this method",ae.Message); } }
public void GetListsTest() { var mockWebClientProxy = new Mock<IWebClientProxy>(); mockWebClientProxy.Setup(x => x.DownloadString(It.IsAny<string>(), It.IsAny<string>())).Returns(() => { return "downloaded string"; }); mockWebClientProxy.Setup(x => x.UploadString(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())) .Returns( () => { return "some result"; }); ApiClientResolver.Instance.Container.Register(mockWebClientProxy.Object); ApiClient apiClient = new ApiClient(); apiClient.Initialize("blah", "user", "password"); string lists = apiClient.GetLists(ReportReturnType.XML); Assert.IsNotNull("downloaded string"); }