Пример #1
0
        public void CanExecuteIsTrueByDefault()
        {
            var viewModel = new LoadTestViewModel();

            var command = new RunLoadTestCommand(viewModel);

            Assert.IsTrue(command.CanExecute(null));
        }
Пример #2
0
        public RunLoadTestCommand(LoadTestViewModel viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException("viewModel");
            }

            _viewModel = viewModel;
        }
Пример #3
0
        public RunLoadTestCommand(LoadTestViewModel viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException("viewModel");
            }

            _viewModel = viewModel;
        }
Пример #4
0
        private static void WaitForLoadTestResult(LoadTestViewModel viewModel)
        {
            var start = DateTime.Now;

            while (viewModel.Result == null)
            {
                if (DateTime.Now.Subtract(start) > TimeSpan.FromSeconds(5)) throw new TimeoutException();

                Thread.Sleep(TimeSpan.FromMilliseconds(1));
            }
        }
Пример #5
0
        static void Main()
        {
            var app = new Application();

            var loadTests = GetLoadTests(Assembly.GetExecutingAssembly());

            var viewModel = new LoadTestViewModel(loadTests);

            var window = new LoadTestWindow
            {
                DataContext = viewModel
            };

            app.Run(window);
        }
Пример #6
0
        public void ShouldUpdateViewModel()
        {
            var viewModel = new LoadTestViewModel
            {
                SelectedTestType = typeof(InMemoryTest100),
                Configuration = new LoadTestConfiguration
                {
                    NumberOfThreads = 1,
                    Duration = TimeSpan.FromSeconds(1)
                }
            };

            var runLoadTestCommand = new RunLoadTestCommand(viewModel);

            runLoadTestCommand.Execute(null);

            WaitForLoadTestResult(viewModel);

            Assert.IsNotNull(viewModel.Heartbeat);
            Assert.IsNotNull(viewModel.Heartbeats);
            Assert.IsTrue(viewModel.Heartbeats.Any());
        }