Esempio n. 1
0
        public Result Run(int iterations)
        {
            try
            {
                Stopwatch sw = new Stopwatch();
                for (int i = 0; i < iterations; i++)
                {
                    Framework.ClearIECache();
                    WebClientEx wc = new WebClientEx();
                    wc.UseDefaultCredentials = true;
                    wc.Timeout = 120000; // 2mins

                    byte[] file = System.IO.File.ReadAllBytes(File);

                    sw.Start();
                    byte[] output = wc.UploadData(Url.TrimEnd("/".ToCharArray()) + "/UploadFileTest " + DateTime.Now.Ticks.ToString() + ".zip", "PUT", file);
                    sw.Stop();

                    output = null;
                    wc.Dispose();
                }

                if (DeleteFiles)
                {
                    RemoveListItems();
                }

                return new Result(Name, (sw.ElapsedMilliseconds / iterations).ToString());
            }
            catch
            {
                return new Result(Name, "-1");
            }
        }
Esempio n. 2
0
        public Result Run(int iterations)
        {
            try
            {
                Stopwatch sw = new Stopwatch();
                for (int i = 0; i < iterations; i++)
                {
                    Framework.ClearIECache();

                    using (WebClientEx wc = new WebClientEx())
                    {
                        wc.UseDefaultCredentials = true;
                        wc.Timeout = 120000; // 2mins

                        sw.Start();
                        var output = wc.DownloadData(Url);
                        sw.Stop();

                        output = null;
                    }
                }

                return new Result(Name, (sw.ElapsedMilliseconds / iterations).ToString());
            }
            catch
            {
                return new Result(Name, "-1");
            }
        }