示例#1
0
        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);
        }
示例#2
0
 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);
     }
 }
示例#3
0
 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");
 }