public void Setup() { _window = new TestWindow <MainWindow>(); _minutesRectangle = _window.GetPrivateField <Rectangle>(field => field.Name.ToLower().Contains("minu")); _secondsRectangle = _window.GetPrivateField <Rectangle>(field => field.Name.ToLower().Contains("sec")); _dispatcherTimer = _window.GetPrivateField <DispatcherTimer>(); if (_dispatcherTimer != null) { _tickEventHandler = _dispatcherTimer.GetPrivateFieldValueByName <EventHandler>(nameof(DispatcherTimer.Tick)); } }
public void Setup() { _testWindow = new TestWindow <MainWindow>(); _hasNameLabel = _testWindow.GetContentControlByPartialContentText <Label>("naam") != null; _hasPasswordLabel = _testWindow.GetContentControlByPartialContentText <Label>("paswoord") != null; _hasNameTextBox = _testWindow.GetPrivateField <TextBox>() != null; _hasPasswordBox = _testWindow.GetPrivateField <PasswordBox>() != null; _okButton = _testWindow.GetContentControlByPartialContentText <Button>("ok"); _hasCancelButton = _testWindow.GetContentControlByPartialContentText <Button>("cancel") != null; _progressBar = _testWindow.GetUIElements <ProgressBar>().FirstOrDefault(); _dispatcherTimer = _testWindow.GetPrivateField <DispatcherTimer>(); if (_dispatcherTimer != null) { _tickEventHandler = _dispatcherTimer.GetPrivateFieldValueByName <EventHandler>(nameof(DispatcherTimer.Tick)); } }
public void Setup() { _testWindow = new TestWindow <MainWindow>(); _paperCanvas = _testWindow.GetPrivateField <Canvas>(field => field.Name.Contains("Canvas")); _beetleObject = _testWindow.GetPrivateField <Beetle>(field => field.Name.ToLower().Contains("_beetle")); _dispatcherTimer = _testWindow.GetPrivateField <DispatcherTimer>(); _tickEventHandler = _dispatcherTimer?.GetPrivateFieldValueByName <EventHandler>(nameof(DispatcherTimer.Tick)); _speedSlider = _testWindow.GetUIElements <Slider>().FirstOrDefault( (slider) => slider.Name.ToUpper().Contains("SPEED")); _sizeSlider = _testWindow.GetUIElements <Slider>().FirstOrDefault( (slider) => slider.Name.ToUpper().Contains("SIZE")); _startButton = _testWindow.GetContentControlByPartialContentText <Button>("Start"); _resetButton = _testWindow.GetContentControlByPartialContentText <Button>("Reset"); _leftButton = _testWindow.GetContentControlByPartialContentText <Button>("Left"); _rightButton = _testWindow.GetContentControlByPartialContentText <Button>("Right"); _downButton = _testWindow.GetContentControlByPartialContentText <Button>("Down"); _upButton = _testWindow.GetContentControlByPartialContentText <Button>("Up"); _speedLabel = _testWindow.GetUIElements <Label>().FirstOrDefault( (label) => label.Name.ToUpper().Contains("SPEED")); _sizeLabel = _testWindow.GetUIElements <Label>().FirstOrDefault( (label) => label.Name.ToUpper().Contains("SIZE")); _messageLabel = _testWindow.GetUIElements <Label>().FirstOrDefault( (label) => label.Name.ToUpper().Contains("MESSAGE")); }