public void CanExecuteIsTrueByDefault() { var viewModel = new LoadTestViewModel(); var command = new RunLoadTestCommand(viewModel); Assert.IsTrue(command.CanExecute(null)); }
public RunLoadTestCommand(LoadTestViewModel viewModel) { if (viewModel == null) { throw new ArgumentNullException("viewModel"); } _viewModel = viewModel; }
public RunLoadTestCommand(LoadTestViewModel viewModel) { if (viewModel == null) { throw new ArgumentNullException("viewModel"); } _viewModel = viewModel; }
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)); } }
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); }
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()); }