public async Task WhenCreatingViewModelForMetricChartWithInvalidEndTimeThenAnExceptionIsThrown() { this.property.EndTimeUtc = null; MetricChartPropertyControlViewModel viewModel = await this.CreateViewModel(); Assert.IsNull(viewModel.ReadChartValuesTask.Result); }
public async Task WhenCreatingViewModelForMetricChartWithDataThenThenItIsCreatedSuccessfully() { // Create view model MetricChartPropertyControlViewModel viewModel = await this.CreateViewModel(); // Verify results Assert.IsFalse(viewModel.ReadChartValuesTask.IsRunning); ChartValues <DateTimePoint> points = viewModel.ReadChartValuesTask.Result; Assert.IsNotNull(points); Enumerable.SequenceEqual(this.timestamps, points.Select(p => p.DateTime)); Enumerable.SequenceEqual(this.values, points.Select(p => p.Value)); }
private async Task <MetricChartPropertyControlViewModel> CreateViewModel() { // Create view model MetricChartPropertyControlViewModel viewModel = new MetricChartPropertyControlViewModel( this.property, this.analysisServicesFactoryMock.Object, this.tracerMock.Object); // Wait till the view is ready int count = 0; while (viewModel.ReadChartValuesTask.IsRunning && count < 100) { count++; await Task.Delay(100); } return(viewModel); }