Пример #1
0
        internal static Playback GetCurrentEtlScope(IEnumerable<string> etlfiles, bool isRealtime)
        {
            try
            {
                if ((etlfiles == null || etlfiles.Count() == 0))
                {
                    return null;
                }
                Playback scope = new Playback();
                foreach (var file in etlfiles)
                {
                    if (isRealtime)
                    {
                        scope.AddRealTimeSession(file);
                    }
                    else
                    {
                        scope.AddEtlFiles(file);
                    }
                }

                return scope;
            }
            catch (Exception)
            {
                throw new Exception("Please try loading the ETL files since the Playback cannot be created.");
            }
        }
Пример #2
0
        static void ListenWithQuery()
        {
            Console.WriteLine("----- Listening with Tx-Playback and Rx query -----");
            _playback = new Playback();
            _playback.AddRealTimeSession(Baseline.SessionName);

            var received = _playback.GetObservable<KNetEvt_RecvIPV4>();

            var x = from window in received.Window(TimeSpan.FromSeconds(1), _playback.Scheduler)
                    from stats in
                        (from packet in window
                         group packet by packet.daddr into g
                         from total in g.Sum(p => p.size)
                         select new
                         {
                             address = new IPAddress(g.Key).ToString(),
                             received = total
                         })
                            .ToList()
                    select stats.OrderBy(s => s.address);
            
            _subscription = x.Subscribe(v =>
            {
                Console.WriteLine("--- {0} ---", DateTime.Now);
                foreach (var s in v)
                    Console.WriteLine("{0, -15} {1,-10:n0} ", s.address, s.received);
                Console.WriteLine();
            });

            _playback.Start();
            Console.ReadLine();
            _subscription.Dispose();
        }
Пример #3
0
        private void TcpSyntheticCounters_Load(object sender, EventArgs e)
        {
            StartSession(SessionName, ProviderId);

            _playback = new Playback();
            _playback.AddRealTimeSession("tcp");

            var received = _playback.GetObservable<KNetEvt_RecvIPV4>();

            var x = from window in received.Window(TimeSpan.FromSeconds(1), _playback.Scheduler)
                    from stats in
                        (   from packet in window
                            group packet by packet.daddr into g
                            from total in g.Sum(p=>p.size)
                            select new
                            {
                                address = new IPAddress(g.Key).ToString(),
                                received = total
                            })
                            .ToList()
                    select stats.OrderBy(s=>s.address);

            _subscription = x.ObserveOn(_chart).Subscribe(v =>
            {
                _chart.BeginInit();

                foreach (var point in v)
                    AddPoint(point.address, point.received);

               _chart.Invalidate();
               _chart.EndInit();
            });

            _playback.Start();
        }
        public void DeserializeMixedStream()
        {
            var input = new[]
            {
                new SimpleEnvelope("JSON", Guid.Parse("daf0be6e-da1e-5a6a-0d49-69782745c885"), Encoding.UTF8.GetBytes(@"""A""")),
                new SimpleEnvelope("JSON", Guid.Parse("daf0be6e-da1e-5a6a-0d49-69782745c885"), new byte[0]),
                new SimpleEnvelope("BOND_V1", new Guid("daf0be6e-da1e-5a6a-0d49-69782745c886"), new byte[] { 41, 1, 65, 0 }),
            };

            IEnumerable<TestBondClass> testBondClassCollection;
            IEnumerable<string> stringCollection;

            using (var playback = new Playback())
            {
                ((IPlaybackConfiguration)playback).AddInput(
                    () => input.ToObservable(),
                    typeof(GeneralPartitionableTypeMap));

                var testBondClassStream = playback.GetObservable<TestBondClass>();
                var stringStream = playback.GetObservable<string>();

                testBondClassCollection = playback.BufferOutput(testBondClassStream);
                stringCollection = playback.BufferOutput(stringStream);

                playback.Run();
            }

            var bondObjects = testBondClassCollection.ToArray();
            Assert.IsNotNull(bondObjects);
            Assert.AreEqual(1, bondObjects.Length);

            var strings = stringCollection.ToArray();
            Assert.IsNotNull(strings);
            Assert.AreEqual(1, strings.Length);
        }
        public void InvalidInputData()
        {
            var input = new[]
            {
                new Envelope(DateTimeOffset.MinValue, DateTimeOffset.MinValue, null, null, null, null, null),
                new Envelope(DateTimeOffset.MinValue, DateTimeOffset.MinValue, null, null, typeof(string).GetTypeIdentifier(), null, null),
                new Envelope(DateTimeOffset.MinValue, DateTimeOffset.MinValue, null, null, null, null, "A"),
                new Envelope(DateTimeOffset.MinValue, DateTimeOffset.MinValue, null, null, typeof(int).GetTypeIdentifier(), null, null),
            };

            IEnumerable<string> stringCollection;

            using (var playback = new Playback())
            {
                ((IPlaybackConfiguration)playback).AddInput(() => input.ToObservable(), typeof(EnvelopeTypeMap));

                var stringStream = playback.GetObservable<string>();

                stringCollection = playback.BufferOutput(stringStream);

                playback.Run();
            }

            var strings = stringCollection.ToArray();
            Assert.IsNotNull(strings);
            Assert.AreEqual(0, strings.Length);
        }
Пример #6
0
        public void SamplesArePlayedToOutput()
        {
            var samplesAtPosition1 = new[] { new Sample("=") };
            var samplesAtPosition2 = new[] { new Sample("=") };
            var samplesAtPosition3 = new[] { new Sample("=") };

            var score = new Mock<IScore>();
            score.Setup(s => s.Samples)
                 .Returns(new Dictionary<int, ICollection<Sample>>
                     {
                         { 0, samplesAtPosition1 },
                         { 8, samplesAtPosition2 },
                         { 16, samplesAtPosition3 }
                     });

            var output = new Mock<IPlaybackOutput>();

            var player = new Playback(output.Object);

            player.Complete += () =>
                {
                    output.Verify(o => o.Play(samplesAtPosition1));
                    output.Verify(o => o.Play(samplesAtPosition2));
                    output.Verify(o => o.Play(samplesAtPosition3));
                };

            player.Play(new ScoreInfo { Score = score.Object });
        }
Пример #7
0
 private static void SetupContext()
 {
     _playback = new Playback();
     _playback.AddEtlFiles(ConfigurationConstants.HttpServerTrace);
     _all = _playback.GetObservable<Parse>();
     _result = new RequestResult<List<Parse>> { Data = new List<Parse>() };
 }
Пример #8
0
        static void Main(string[] args)
        {
            _listener.Prefixes.Add("http://" + Environment.MachineName + ":9000/");
            _listener.Start();
            Console.WriteLine("Listening ...");

            while (true)
            {
                HttpListenerContext context = _listener.GetContext();
                _request = context.Request;

                HttpListenerResponse response = context.Response;

                _sb = new StringBuilder("<HTML>\n<HEAD>\n<TITLE>");
                _sb.Append("Trace 2 Html");
                _sb.Append("</TITLE>\n</HEAD>\n<BODY>\n");
                _sb.Append("<pre style=\"font-family:Consolas; font-size: 10pt; width: 5000px;\">");

                _playback = new Playback();
                _playback.AddEtlFiles(LocalTrace);
                _all = _playback.GetObservable<TracedEvent>();

                if (_request.QueryString["process"] != null)
                {
                    _processFilter = _request.QueryString["process"];
                    _all = _all.Where(e => e.Message.StartsWith(_processFilter));
                }
                else
                {
                    _processFilter = null;
                }

                if (_request.QueryString["after"] != null)
                {
                    var after = int.Parse(_request.QueryString.Get("after"));
                    AllHistory(after);
                }
                else if (_request.QueryString["afterReceive"] != null)
                {
                    string messageId = _request.QueryString.Get("afterReceive");
                    AfterReceive(messageId);
                }
                else if (_request.QueryString["beforeSend"] != null)
                {
                    string messageId = _request.QueryString.Get("beforeSend");
                    BeforeSend(messageId);
                }
                else
                {
                    AllHistory(0);
                }
                _sb.Append("</BODY></HTML>");
                byte[] buffer = Encoding.UTF8.GetBytes(_sb.ToString());
                response.ContentLength64 = buffer.Length;
                response.OutputStream.Write(buffer, 0, buffer.Length);
                response.OutputStream.Close();
                _playback.Dispose();
            }
        }
Пример #9
0
        static void Read()
        {
            Playback playback = new Playback();
            playback.AddBondEtlFiles(sessionName + ".etl");

            playback.GetObservable<Evt>()
                .Subscribe(e=> Console.WriteLine("{0}: {1}", e.Time, e.Message));

            playback.Run();
        }
Пример #10
0
        private void TcpSyntheticCounters_Load(object sender, EventArgs e)
        {
            _playback = new Playback();
            _playback.AddRealTimeSession(PerfCounterSessionName);

            IObservable<PerformanceSample> perfCounters = PerfCounterObservable.FromRealTime(TimeSpan.FromSeconds(1), CounterPaths);
            _subscription = perfCounters.ObserveOn(_chart).Subscribe(CounterAdded);

            _playback.Start();
        }
Пример #11
0
        static void Main(string[] args)
        {
            Playback playback = new Playback();
            playback.AddUlsFiles(@"..\..\WAC.log");

            var s = playback.GetObservable<LeavingMonitoredScope>();
            s.Subscribe(e => Console.Write(e.Scope));

            playback.Run();
        }
Пример #12
0
        public void W3CPlayback()
        {
            Playback playback = new Playback();
            playback.AddW3CLogFiles("u_ex130609.log");
            int count = 0;
            playback.GetObservable<W3CEvent>().Count().Subscribe(c => count = c);
            playback.Run();

            Assert.AreEqual(17, count);
        }
Пример #13
0
        public void PlayOne()
        {
            var p = new Playback();
            p.AddEtlFiles(EtlFileName);

            int count = 0;
            p.GetObservable<Parse>().Subscribe(e => { count++; });
            p.Run();

            Assert.AreEqual(291, count);
        }
Пример #14
0
        public void PlayRoot()
        {
            var p = new Playback();
            p.AddEtlFiles(EtlFileName);

            int count = 0;
            p.GetObservable<SystemEvent>().Subscribe(e => { count++; });
            p.Run();

            Assert.AreEqual(2041, count);     
        }
Пример #15
0
        static void Main()
        {
            Playback playback = new Playback();
            playback.AddEtlFiles(@"..\..\..\HTTP_Server.etl");
            playback.AddLogFiles(@"..\..\..\HTTP_Server.evtx");

            IObservable<SystemEvent> all = playback.GetObservable<SystemEvent>();

            all.Count().Subscribe(Console.WriteLine);

            playback.Run();
        }
Пример #16
0
 public async void initValue()
 {
     musicList.Clear();
     await getFiles(musicList, folder);
     STT = 0;
     musicProperties = null;
     stream = null;
     state = MediaState.STOP;
     pb = Playback.ORDER;
     rp = Repeat.ALL;
     nof = NumOfLoad.FIRST;
 }
Пример #17
0
        static void Main()
        {
            Playback playback = new Playback();
            playback.AddEtlFiles(@"HTTP_Server.etl");

            IObservable<Deliver> startEvents = playback.GetObservable<Deliver>();
            IObservable<FastResp> endEvents = playback.GetObservable<FastResp>();

            var requests = from start in startEvents
                           from end in endEvents
                                .Where(e => start.Header.ActivityId == e.Header.ActivityId)
                                .Take(TimeSpan.FromSeconds(1), playback.Scheduler) // <-- Playback virtual time!
                                .Take(1)
                           select new
                           {
                               start.Url,
                               end.StatusCode,
                               Duration = end.Header.Timestamp - start.Header.Timestamp
                           };

            var statistics = from window in requests.Window(TimeSpan.FromSeconds(5), playback.Scheduler)
                             from stats in
                                 (   // calculate statistics within one window
                                     from request in window
                                     group request by new
                                         {
                                             Milliseconds = Math.Ceiling(request.Duration.TotalMilliseconds * 10) / 10,
                                             request.Url
                                         } into g
                                     from Count in g.Count()
                                     select new
                                     {
                                         g.Key.Url,
                                         g.Key.Milliseconds,
                                         Count
                                     })
                                     .ToList() 
                             select stats;

            IDisposable d = statistics.Subscribe(b =>
                {
                    Console.WriteLine("--------------------------");
                    foreach (var s in b.OrderBy(s => s.Milliseconds)) // <-- LINQ to Objects!
                    {
                        Console.WriteLine(s);
                    }
                });

            playback.Run();

            Console.ReadLine();
            d.Dispose();
        }
Пример #18
0
        static void VirtualTime()
        {
            // This sample illustrates the concept of Virtual Time, constructed as per timestamps of the events in the file 
            Console.WriteLine("----- VirtualTime -----");

            Playback playback = new Playback();
            playback.AddEtlFiles(@"HTTP_Server.etl");

            playback.GetObservable<Parse>().Subscribe(p => Console.WriteLine("{0} {1}",
                playback.Scheduler.Now.DateTime, p.Url));

            playback.Run();
        }
Пример #19
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Playback playback = new Playback();

            playback.AddTextTrace(@"..\..\sorted.csv");
            IObservable<PartitionEvent> all = playback.GetObservable<PartitionEvent>();

            all.ObserveOn(this)
                .Subscribe(evt=>
                {
                    double x = (evt.Timeflag-startTime).TotalHours;
                    double y = PartitionY(evt.PartitionId);
                    AddPoint(evt.PartitionId, x, y);
                });

            #region outage detection

            var grouped = (from a in all.GroupByUntil(
                                    evt => evt.PartitionId,
                                    g => Observable.Timer(TimeSpan.FromMinutes(10), playback.Scheduler))
                           from Count in a.Count()
                           where Count > 100
                           select new
                           {
                               PartitionId = a.Key,
                               Count
                           })
                          .Timestamp(playback.Scheduler);


            _subscription = grouped.ObserveOn(this).Subscribe(evt =>
                {
                    double x = (evt.Timestamp - startTime).TotalHours;
                    double y = PartitionY(evt.Value.PartitionId);
                    _detected.Points.AddXY(x, y);
                });

            #endregion

            #region
            //all.Throttle(TimeSpan.FromMinutes(1), playback.Scheduler) // <-- Playback virtual time!
            //    .ObserveOn(this)
            //    .Subscribe(evt =>
            //        {
            //            double horizon = (evt.Timeflag - startTime).TotalHours - 2;
            //            CleanTo(horizon);
            //        });
            #endregion

            playback.Start();
        }
Пример #20
0
        public void PlayRootAndKnownType()
        {
            var p = new Playback();
            p.AddEtlFiles(EtlFileName);

            int count = 0;
            p.GetObservable<SystemEvent>().Subscribe(e => { count++; });
            int parseCount = 0;
            p.GetObservable<Deliver>().Subscribe(e => { parseCount++; });
            p.Run();

            Assert.AreEqual(2041, count);
            Assert.AreEqual(291, parseCount);
        }
Пример #21
0
        static void Option2_Playback()
        {
            Playback playback = new Playback();
            playback.AddXelFiles(@"..\..\*.xel");

            IObservable<login_timing> logins = playback.GetObservable<login_timing>();

            logins
                .Take(TimeSpan.FromMinutes(1), playback.Scheduler)
                .Where(l => l.LoginDurationMs > 100)
                .Subscribe(l=>Console.WriteLine(l.LoginDurationMs));

            playback.Run();
        }
Пример #22
0
        public void PlayTwo()
        {
            var p = new Playback();
            p.AddEtlFiles(EtlFileName);

            int parseCount = 0;
            int fastSendCount = 0;
            p.GetObservable<Deliver>().Subscribe(e => { parseCount++; });
            p.GetObservable<FastResp>().Subscribe(e => { fastSendCount++; });
            p.Run();

            Assert.AreEqual(291, parseCount);
            Assert.AreEqual(289, fastSendCount);
        }
        public void FormLoginKH_HopLe()
        {
            //this.UIMap.TenDangNhapRong();
            Playback.PlaybackSettings.WaitForReadyLevel   = WaitForReadyLevel.Disabled;
            Playback.PlaybackSettings.DelayBetweenActions = 500;
            Playback.PlaybackSettings.SearchTimeout       = 10000;
            try
            {
                BrowserWindow browser = BrowserWindow.Launch("http://localhost:12742/");
                browser.Maximized = true;
                browser.DrawHighlight();
                //Playback.Wait(5000);

                UITestControl btnLogin = new UITestControl(browser);
                btnLogin.TechnologyName = "MSAA";
                btnLogin.SearchProperties.Add("Name", "Đăng nhập");
                btnLogin.SearchProperties.Add("ControlType", "Edit");
                btnLogin.DrawHighlight();
                Mouse.Click(btnLogin);
                //Playback.Wait(500);

                UITestControl txtTen = new UITestControl(browser);
                txtTen.TechnologyName = "MSAA";
                txtTen.SearchProperties.Add("Name", "Nhập tài khoản ...");
                txtTen.SearchProperties.Add("ControlType", "Edit");
                txtTen.DrawHighlight();
                Keyboard.SendKeys(txtTen, "UyenSoCute");

                UITestControl txtPass = new UITestControl(browser);
                txtPass.TechnologyName = "MSAA";
                txtPass.SearchProperties.Add("Name", "Mật khẩu ...");
                txtPass.SearchProperties.Add("ControlType", "Edit");
                txtPass.DrawHighlight();
                Keyboard.SendKeys(txtPass, "1");

                UITestControl btnDangNhap = new UITestControl(browser);
                btnDangNhap.TechnologyName = "MSAA";
                btnDangNhap.SearchProperties.Add("Name", "Đăng nhập");
                btnDangNhap.SearchProperties.Add("ControlType", "Button");
                btnDangNhap.DrawHighlight();
                Mouse.Click(btnDangNhap);

                Playback.Wait(1000);
            }
            catch (Exception e)
            {
                Assert.Fail(e.ToString());
            }
        }
Пример #24
0
        private void RefreshVM(Zone zone)
        {
            TheZone = zone;

            if (null == zone.Surround)
            {
                DSPTitle = "Default";
            }
            else
            {
                if (zone.Surround.StraitOn)
                {
                    DSPTitle = Surround.DSP_Strait;
                }
                else
                {
                    DSPTitle = zone.Surround.DSP;
                }
            }
            foreach (var dsp in DSPs)
            {
                dsp.IsSelected = (dsp.SelectString == DSPTitle);
            }

            IsOn           = zone.PowerOn;
            IsPureDirectOn = zone.PureDirectOn;

            //-- Updated Selected Input
            for (int i = 0; i < zone.Inputs.Length; i++)
            {
                if (zone.Inputs[i].Param == zone.SelectedInput)
                {
                    InputTitle           = Inputs[i].DisplayName;
                    ImageUri             = Inputs[i].ImageUri;
                    Inputs[i].IsSelected = true;

                    SelectedInput = zone.Inputs[i];
                    List          = new VMList(MainVM, zone.Inputs[i], zone);
                }
                else
                {
                    Inputs[i].IsSelected = false;
                }
            }

            Volume.Refresh();
            Playback.Refresh();
            ZoneTitle = zone.DisplayName;
        }
Пример #25
0
        public static void LoginToApplication(BrowserWindow localbw, String Usernamevalue, String Passwordvalue)
        {
            LoginScreen loginscreenobj = new LoginScreen(localbw);

            //Enter Username
            for (int i = 0; i < Configurations.SyncTime; i++)
            {
                try
                {
                    loginscreenobj.UserName.Text = Usernamevalue;
                    Console.WriteLine("Entered username as " + Usernamevalue);
                    break;
                }
                catch (Exception)
                {
                    Playback.Wait(1000);
                }
            }

            //Enter Password
            for (int i = 0; i < Configurations.SyncTime; i++)
            {
                try
                {
                    loginscreenobj.Password.Text = Passwordvalue;
                    Console.WriteLine("Entered password");
                    break;
                }
                catch (Exception)
                {
                    Playback.Wait(1000);
                }
            }
            //Click on Login button

            for (int i = 0; i < Configurations.SyncTime; i++)
            {
                try
                {
                    Mouse.Click(loginscreenobj.LoginButton);
                    Console.WriteLine("Clicked on Login button");
                    break;
                }
                catch (Exception)
                {
                    Playback.Wait(1000);
                }
            }
        }
Пример #26
0
        /// <summary>
        /// Drags the resource from the explorer to the active tab.
        /// </summary>
        /// <param name="resourceName">The name of the resource.</param>
        /// <param name="categoryName">The name of the category.</param>
        /// <param name="serverName">Name of the server (Will default to "localhost").</param>
        /// <returns></returns>
        public UITestControl DoubleClickWorkflow(string resourceName, string categoryName, string serverName = "localhost")
        {
            DoubleClickResource(resourceName, categoryName, serverName);
            UITestControl newTab = TabManagerUIMap.GetActiveTab();

            int counter = 0;

            while (newTab == null || !TabManagerUIMap.GetActiveTabName().Contains(resourceName) && counter < 7)
            {
                Playback.Wait(500);
                newTab = TabManagerUIMap.GetActiveTab();
                counter++;
            }
            return(newTab);
        }
Пример #27
0
        public void VerifyStateHoliday()
        {
            EllisHome.LaunchEllisAsPRMUser();
            EllisHome.ClickOnStateHoliday();
            Playback.Wait(3000);
            var datarows = ExcelReader.ImportSpreadsheet(ExcelFileNames.UnclaimedProperty);

            foreach (var datarow in datarows)
            {
                CreateNewOrderWindow.EnterDataInStateHoliday(datarow);
                Factory.AssertIsTrue(CreateNewOrderWindow.VerifyNoResultsFoundWindowDisplayed(),
                                     "No Results Found Window Not Displayed");
                CreateNewOrderWindow.ClickOnOkBtnNoresults();
            }
        }
Пример #28
0
        public void VerifyOverTimeRules()
        {
            EllisHome.LaunchEllisAsPRMUser();
            EllisHome.ClickOnOvertime();
            Playback.Wait(5000);
            var datarows = ExcelReader.ImportSpreadsheet(ExcelFileNames.UnclaimedProperty);

            foreach (var datarow in datarows)
            {
                CreateNewOrderWindow.EnterDatainOverTimeWindow(datarow);
                Factory.AssertIsTrue(CreateNewOrderWindow.VerifyOverTimeWindowDisplayed(), "OVerTime Window Not displayed");
                CreateNewOrderWindow.ClickModifyBtnOverTime();
                CreateNewOrderWindow.ClickokBtnSaveSucccess();
            }
        }
Пример #29
0
        //click on save

        public static void savemethod()
        {
            WinWindow save = new WinWindow(note)
            {
                TechnologyName = "MSAA"
            };

            save.SearchProperties.Add("Name", "Save	Ctrl+S", "ControlType", "MenuItem");
            Mouse.Click(save);
            Playback.Wait(2000);
            Keyboard.SendKeys("ninu");
            Playback.Wait(2000);
            Keyboard.SendKeys("{Enter}");
            Playback.Wait(2000);
        }
Пример #30
0
        public void PlayTwoBothEtlAndEvtx()
        {
            var p = new Playback();
            p.AddEtlFiles(EtlFileName);
            p.AddLogFiles(EvtxFileName);

            int parseCount = 0;
            int fastSendCount = 0;
            p.GetObservable<Deliver>().Subscribe(e => { parseCount++; });
            p.GetObservable<FastResp>().Subscribe(e => { fastSendCount++; });
            p.Run();

            Assert.AreEqual(581, parseCount);     // there seems to be one event that was lost in the etl->evt conversion...
            Assert.AreEqual(579, fastSendCount);  // and one more event here...
        }
Пример #31
0
        static void CountAll()
        {
            // Subscribing to SystemEvent means "all ETW events"
            Console.WriteLine("----- CountAll -----");

            Playback playback = new Playback();

            playback.AddEtlFiles(@"HTTP_Server.etl");

            var all = playback.GetObservable <SystemEvent>();

            all.Count().Subscribe(Console.WriteLine);

            playback.Run();
        }
Пример #32
0
        internal void Play()
        {
            Task.Run(() =>
            {
                using (Playback = _midiFile.GetPlayback(Device))
                {
                    // Playback.MoveToStart();
                    Playback.Play();
                    // Application.Current.Dispatcher.Invoke(() =>);
                }
            });


            //Dispatcher.CurrentDispatcher.Invoke(()=> );
        }
        static void Main(string[] args)
        {
            Playback.Initialize();
            //  ClickWindowButton("LOWIS:", "Add a new Position");
            string trycount = ConfigurationManager.AppSettings["trycount"];
            int    cnt      = Convert.ToInt32(trycount);

            for (int i = 0; i < cnt; i++)
            {
                //  clickaddcancel();
                clickdeletepositions();
                Playback.Wait(3000);
            }
            Playback.Cleanup();
        }
Пример #34
0
 public void SaveWebService(string serviceName)
 {
     //Web Service Details
     KeyboardCommands.SendTabs(8);
     Playback.Wait(500);
     KeyboardCommands.SendEnter();
     Playback.Wait(500);//wait for test
     KeyboardCommands.SendTab();
     KeyboardCommands.SendEnter();
     Playback.Wait(500);
     KeyboardCommands.SendTabs(3);
     KeyboardCommands.SendKey(serviceName);
     KeyboardCommands.SendTab();
     KeyboardCommands.SendEnter();
 }
Пример #35
0
        public void HTTP_Parse_Format()
        {
            string msg = "";

            var pb = new Playback();

            pb.AddEtlFiles(EtlFileName);

            var parsed = pb.GetObservable <Parse>().Take(1);

            parsed.Subscribe(p => msg = p.ToString());
            pb.Run();

            Assert.AreEqual(msg, "Parsed request (request pointer 18446738026454074672, method 4) with URI http://georgis2:80/windir.txt");
        }
Пример #36
0
            public void GlobalSetup()
            {
                var midiEvents = Enumerable.Range(0, 100)
                                 .SelectMany(_ => new MidiEvent[] { new NoteOnEvent {
                                                                        DeltaTime = 1
                                                                    }, new NoteOffEvent {
                                                                        DeltaTime = 1
                                                                    } })
                                 .ToList();

                _playback = new Playback(midiEvents, TempoMap.Default);

                _playbackWithNoteCallback = new Playback(midiEvents, TempoMap.Default);
                _playbackWithNoteCallback.NoteCallback = (d, rt, rl, t) => new NotePlaybackData(d.NoteNumber, d.Velocity, d.OffVelocity, d.Channel);
            }
Пример #37
0
        public void EventTypeStatistics()
        {
            var all        = Playback.GetObservable <SystemEvent>();
            var statistics = from e in all
                             group e by new { e.Header.ProviderId, e.Header.EventId, e.Header.Opcode, e.Header.Version }
            into g
            from c in g.Count()
            select new
            {
                g.Key,
                Count = c,
            };

            RegisterForValidation(statistics, 11);
        }
Пример #38
0
        static void Option2_Playback()
        {
            Playback playback = new Playback();

            playback.AddXelFiles(@"gatewaysample.xel");

            IObservable <login_timing> logins = playback.GetObservable <login_timing>();

            logins
            .Take(TimeSpan.FromMinutes(1), playback.Scheduler)
            .Where(l => l.LoginDurationMs > 100)
            .Subscribe(l => Console.WriteLine(l.LoginDurationMs));

            playback.Run();
        }
Пример #39
0
        public void WaitForStepCount(int expectedStepCount, int timeOut)
        {
            const int interval = 100;
            int       count    = 0;

            while (GetOutputWindow().Count < expectedStepCount && count <= timeOut)
            {
                Playback.Wait(interval);
                count = count + interval;
            }
            if (count == timeOut && GetOutputWindow().Count < expectedStepCount)
            {
                throw new Exception("Debug output never reached the expected step count in the given time out");
            }
        }
 protected override void OnDisable()
 {
     if (Playback != null)
     {
         if (Playback.IsPlaying)
         {
             Playback.Pause();
             m_isPlayingPreviousState = true;
         }
         else
         {
             m_isPlayingPreviousState = false;
         }
     }
 }
Пример #41
0
        public static void EnterDate(string datetype, string date)
        {
            var fromWindow = Actions.GetWindowChild(EllisWindow, datetype);
            var comboBox   = (WinComboBox)fromWindow;

            MouseActions.Click(comboBox);
            for (int i = 0; i < 10; i++)
            {
                SendKeys.SendWait("{BACKSPACE}");
                Playback.Wait(200);
            }
            //SendKeys.SendWait("{HOME}");
            Playback.Wait(1500);
            SendKeys.SendWait(date);
        }
Пример #42
0
 public void CreateWebSource(string sourceUrl, string sourceName)
 {
     //Web Source Details
     KeyboardCommands.SendKey(sourceUrl);
     KeyboardCommands.SendTabs(3);
     Playback.Wait(100);
     KeyboardCommands.SendEnter();
     Playback.Wait(1000);
     WebSourceWizardUIMap.ClickSave();
     KeyboardCommands.SendTabs(3);
     KeyboardCommands.SendKey(sourceName);
     KeyboardCommands.SendTab();
     KeyboardCommands.SendEnter();
     Playback.Wait(1000);
 }
Пример #43
0
    /// <summary>Coroutine to close the Stat Updater after some amount of unscaled time.</summary>
    /// <param name="time">Time to wait.</param>
    /// <returns>IEnumerator for the Coroutine.</returns>
    private IEnumerator Close(float time)
    {
        yield return(new WaitForSecondsRealtime(time));

        fastForward = false;
        if (updateQueue.Count < 1)
        {
            Playback.ReleasePause(pauseKey);
            menu.Close();
        }
        else
        {
            menu.Cycle();
        }
    }
Пример #44
0
        public void Dispose_ShouldDisposeSampleSource()
        {
            // Arrange
            var sampleSource = Substitute.For <ISampleSource>();

            sampleSource.WaveFormat.Returns(new WaveFormat(44100, 32, 2, AudioEncoding.IeeeFloat));
            var       track    = _mixer.AddTrack(sampleSource);
            IPlayback playback = new Playback(_mixer, track);

            // Act
            playback.Dispose();

            // Assert
            sampleSource.Received(1).Dispose();
        }
Пример #45
0
        public static void BeforeScenarioBlock()
        {
            // initialize Coded UI Test playback
            if (!Playback.IsInitialized)
            {
                Playback.Initialize();
            }

#if VS2010
            // Visual Studio 2010 doesn't have a Playback.PlaybackSettings.LoggerOverrideState property
#else
            // set playback settings
            Playback.PlaybackSettings.LoggerOverrideState = HtmlLoggerState.AllActionSnapshot;
#endif
        }
        public void VerifyEmployeeGarnishments()
        {
            TestBase.LaunchInternetExplorerWithEmpowerPayQA();
            TestBase.Login.LoginAsAdmin("998");
            TestBase.LeftMenuTestCases.ClickLeftMenuParentLink("Employee Compensation");
            TestBase.LeftMenuTestCases.ClickLeftMenuChildLink("Deductions");
            Playback.Wait(5000);

            TestBase.HeaderTestCases.SelectTab("Garnishments");
            TestBase.HeaderTestCases.EnterEmployeeNumber("1177");
            Keyboard.SendKeys("{Enter}");

            Playback.Wait(10000);
            Assert.AreEqual("", TestBase.HeaderTestCases.GetDeductionTextBoxText());
        }
        public void VerifyEmployeeDeductionCode()
        {
            TestBase.LaunchInternetExplorerWithEmpowerPayQA();
            TestBase.Login.LoginAsAdmin("998");
            TestBase.LeftMenuTestCases.ClickLeftMenuParentLink("Employee Compensation");
            TestBase.LeftMenuTestCases.ClickLeftMenuChildLink("Deductions");
            Playback.Wait(5000);

            TestBase.HeaderTestCases.EnterEmployeeNumber("6598565");
            Keyboard.SendKeys("{Enter}");

            Playback.Wait(12000);
            ///Assert.AreEqual("Bonus Dues", TestBase.HeaderTestCases.GetDeductionTextBoxText());
            Assert.AreEqual("Child Support", TestBase.HeaderTestCases.GetDeductionTextBoxText());
        }
Пример #48
0
        public static void NavigateToFolder(string path)
        {
            var explorerWindow = new UIWindowsExplorer();

            explorerWindow.FilePathToolbar.WaitForControlExist();
            explorerWindow.FilePathToolbar.EnsureClickable();

            Mouse.Click(explorerWindow.FilePathToolbar);

            Keyboard.SendKeys(path);
            Keyboard.SendKeys("{Enter}");
            Playback.Wait(1000);

            Mouse.Click(explorerWindow.FilePathToolbar);
        }
        public void NotificationSimpleSearch()
        {
            var datarows = Initialize();

            foreach (var datarow in datarows.Where(datarow => datarow.ItemArray[4].ToString().Equals("Lockout")))
            {
                Console.WriteLine(datarow.ItemArray[3]);
                SearchWindow.SelectSearchElements(datarow.ItemArray[5].ToString(), "Lockout",
                                                  SearchWindow.SearchTypeConstants.Simple);
                Playback.Wait(3000);

                Factory.AssertIsTrue(SimpleSearchWindow.VerifyLockoutOverideWindowDisplayed(), "Results are displayed for the search criteria");
                TitlebarActions.ClickClose((WinWindow)SimpleSearchWindow.GetLockoutOverideWindowProperties());
            }
            Cleanup();
        }
        public void BillingLineItemSearch()
        {
            var datarows = Initialize();

            foreach (var datarow in datarows.Where(datarow => datarow.ItemArray[4].ToString().Equals("BillingLineItem")))
            {
                Console.WriteLine(datarow.ItemArray[3]);
                SearchWindow.SelectSearchElements(datarow.ItemArray[5].ToString(), "BillingLineItem",
                                                  SearchWindow.SearchTypeConstants.Simple);
                Playback.Wait(3000);

                Factory.AssertIsTrue(SimpleSearchWindow.VerifySearchResultsWindowDisplayed(), "Search results window is not displayed for the search criteria");
                SimpleSearchWindow.CloseResultsWindow();
            }
            Cleanup();
        }
        public void QuoteSearch()
        {
            var datarows = Initialize();

            foreach (var datarow in datarows.Where(datarow => datarow.ItemArray[4].ToString().Equals("Quote")))
            {
                Console.WriteLine(datarow.ItemArray[3]);
                SearchWindow.SelectSearchElements(datarow.ItemArray[5].ToString(), "Quote",
                                                  SearchWindow.SearchTypeConstants.Simple);

                Factory.AssertIsTrue(CustomerProfileWindow.VerifyQuoteProfileWindowDisplayed(), "Quote profile window is not displayed");
                CustomerProfileWindow.CloseQuoteProfileWindow();
                Playback.Wait(5000);
            }
            Cleanup();
        }
Пример #52
0
        public static void SetMaskedText(UITestControl windowinst, string controlName, string data)
        {
            var control = Actions.GetWindowChild(windowinst, controlName);

            control.SetFocus();
            Playback.Wait(200);
            SendKeys.SendWait("{END}");
            Playback.Wait(200);
            SendKeys.SendWait("+{HOME}");
            Playback.Wait(200);
            SendKeys.SendWait("{DEL}");
            Playback.Wait(200);
            SendKeys.SendWait("{HOME}");
            Playback.Wait(200);
            SendKeys.SendWait(data);
        }
Пример #53
0
        public void DsfActivityTests_CodedUI_SetInitialFocusElementIfNoInputs_HelpTextIsNotEmpty()
        {
            const string expectedHelpText = @"Only variables go in here.
Insert the variable that you want the output of the workflow to be mapped into. By default similar matches from the variable list are used where possible.
You can use [[Scalar]] as well as [[Recordset().Fields]].
Using recordset () will add a new record and (*) will assign every record.";

            using (var dsfActivityUiMap = new DsfActivityUiMap())
            {
                dsfActivityUiMap.DragWorkflowOntoDesigner("Sql Bulk Insert Test", "TEST");
                Playback.Wait(500);
                dsfActivityUiMap.ClickHelp();
                string actualHelpText = dsfActivityUiMap.GetHelpText();
                Assert.AreEqual(expectedHelpText, actualHelpText);
            }
        }
Пример #54
0
        public void BlgPivotTwo()
        {
            // this query pivots the counters into separate collections for Processor and PhysicalDisk

            Playback playback = new Playback();
            playback.AddPerfCounterTraces(BlgFileName);

            var all = playback.GetObservable<PerformanceSample>();

            var processor = PivotToInstanceSnapshots(playback, "Processor");
            var disk = PivotToInstanceSnapshots(playback,"PhysicalDisk");

            playback.Run();

            Assert.AreEqual(3000, processor.Count()); // there are 5 instances: _Total, 0, 1, 2, 3
            Assert.AreEqual(600, disk.Count());
        }
Пример #55
0
        public void HTTP_Parse()
        {
            var pb = new Playback();
            pb.AddEtlFiles(EtlFileName);
            var parsed = from p in pb.GetObservable<Parse>()
                         select new
                         {
                             p.Header.ActivityId,
                             p.Url
                         };

            int count = 0;
            parsed.Count().Subscribe(c => count = c);
            pb.Run();

            Assert.AreEqual(291, count);
        }
Пример #56
0
        public void ProcessStopTest()
        {
            var pb = new Playback();
            pb.AddEtlFiles(EtlFileName);
            var stop = from p in pb.GetObservable<ProcessStop>() // this is V1 event
                       select new
                       {
                           p.ProcessID,
                           p.ImageName
                       };

            int count = 0;
            stop.Count().Subscribe(c => count = c);
            pb.Run();

            Assert.AreEqual(4, count);
        }
Пример #57
0
        public void HTTP_FastSend()
        {
            var pb = new Playback();
            pb.AddEtlFiles(EtlFileName);
            var parsed = from s in pb.GetObservable<FastSend>()
                         select new
                        {
                            s.Header.ActivityId,
                            s.HttpStatus
                        };

            int count = 0;
            parsed.Count().Subscribe(c => count = c);
            pb.Run();

            Assert.AreEqual(289, count);
        }
Пример #58
0
        static void Main()
        {
            Playback playback = new Playback();
            playback.AddRealTimeSession("tcp");

            var recv = from req in playback.GetObservable<KNetEvt_RecvIPV4>()
                        select new
                        {
                            Time = req.OccurenceTime,
                            Size = req.size,
                            Address = new IPAddress(req.daddr)
                        };


            recv.Subscribe(e=>Console.WriteLine("{0} : Received {1,5} bytes from {2}", e.Time, e.Size, e.Address));

            playback.Start();
        }
Пример #59
0
        static void GetObservable()
        {
            // This sample illustrates parsing single input file and transforming only the events that are of interest
            Console.WriteLine("----- GetObservable -----");

            Playback playback = new Playback();
            playback.AddEtlFiles(@"HTTP_Server.etl");

            playback.GetObservable<Parse>().Subscribe(p => Console.WriteLine(p.Url));

            playback.Run();

            //Here: 
            //  - HTTP_Server.etl is trace from HTTP.sys (the bottom layer of IIS)
            //  - The type Parse was generated from the ETW manifest description of the first event IIS traces for each request (EventId = 2)
            //  - Subscribe just wires-up the processing of Parse events, and nothing shows on the console yet. 
            //    Reading the file happens within Run().
        }
Пример #60
0
        static void Main()
        {
            Playback playback = new Playback();
            playback.AddEtlFiles(@"..\..\..\HTTP_Server.etl");
            playback.AddLogFiles(@"..\..\..\HTTP_Server.evtx");

            IObservable<SystemEvent> all = playback.GetObservable<SystemEvent>();

            var counts = from window in all.Window(TimeSpan.FromSeconds(5), playback.Scheduler)
                    from Count in window.Count()
                    select Count;

            var withTime = counts.Timestamp(playback.Scheduler);

            withTime.Subscribe(ts => Console.WriteLine("{0} {1}", ts.Timestamp, ts.Value));

            playback.Run();
        }