Ejemplo n.º 1
0
 //[TestMethod]
 public void Start()
 {
     try
     {
         string           requestToken;
         WSModelProcessor processor = PostRequest(out requestToken);
         MemoryStream     docStream = new MemoryStream(System.Text.ASCIIEncoding.ASCII.GetBytes(SQL_TEXT));
         processor.RequestDocument("1", "0", docStream);
         docStream.Close();
         processor.Start("1", false);
         processor.Close("1");
     }
     catch (Exception e)
     {
         Assert.Fail(e.Message, e);
     }
 }
Ejemplo n.º 2
0
 //[TestMethod]
 public void Status()
 {
     try
     {
         string           requestToken;
         WSModelProcessor processor = PostRequest(out requestToken);
         MemoryStream     docStream = new MemoryStream(System.Text.ASCIIEncoding.ASCII.GetBytes(SQL_TEXT));
         processor.RequestDocument("1", "0", docStream);
         docStream.Close();
         processor.Start("1", false);
         RequestStatus status = processor.Status("1");
         Assert.AreEqual(RequestStatus.StatusCode.Complete, status.Code);
         //Assert.AreEqual("Done. Wancheng. Finito.", status.Message);
         processor.Close("1");
     }
     catch (Exception e)
     {
         Assert.Fail(e.Message, e);
     }
 }
Ejemplo n.º 3
0
 //[TestMethod]
 public void Response()
 {
     try
     {
         string           requestToken;
         WSModelProcessor processor = PostRequest(out requestToken);
         MemoryStream     docStream = new MemoryStream(System.Text.ASCIIEncoding.ASCII.GetBytes(SQL_TEXT));
         processor.RequestDocument("1", "0", docStream);
         docStream.Close();
         processor.Start("1", false);
         while (processor.Status("1").Code != RequestStatus.StatusCode.Complete)
         {
             ;
         }
         Document[] documents = processor.Response("1");
         processor.Close("1");
     }
     catch (Exception e)
     {
         Assert.Fail(e.Message, e);
     }
 }
Ejemplo n.º 4
0
 //[TestMethod]
 public void ResponseDocument()
 {
     try
     {
         string           requestToken;
         WSModelProcessor processor = PostRequest(out requestToken);
         MemoryStream     docStream = new MemoryStream(System.Text.ASCIIEncoding.ASCII.GetBytes(SQL_TEXT));
         processor.RequestDocument("1", "0", docStream);
         docStream.Close();
         processor.Start("1", false);
         while (processor.Status("1").Code != RequestStatus.StatusCode.Complete)
         {
             ;
         }
         Document[] documents = processor.Response("1");
         //FileStream outStream = new FileStream(@"C:\Users\daniel\tmp\New-" + documents[0].Filename, FileMode.Create);
         Stream contentStream;
         processor.ResponseDocument("1", "0", out contentStream, documents[0].Size);
         using (StreamReader reader = new StreamReader(contentStream))
         {
             string datasetXml = reader.ReadToEnd();
         }
         //int bytesRead = 0;
         //byte[] buffer = new byte[5000];
         //while ((bytesRead = contentStream.Read(buffer, 0, 5000)) > 0)
         //{
         //    //outStream.Write(buffer, 0, 5000);
         //}
         contentStream.Close();
         //outStream.Close();
         processor.Close("1");
     }
     catch (Exception e)
     {
         Assert.Fail(e.Message, e);
     }
 }