public void LoadSettingsExecuteTests() { var vm = new ProcessMetricsGadgetChartTabViewModel(); vm.Parent = new ProcessMetricsGadgetViewModel(); vm.LoadSettings(new Dictionary<string, string> { { "MerticFilter", filterDefinition } }); Assert.IsNotNull(vm.Gadget.FilterList); Assert.IsTrue(vm.Gadget.FilterList.Any()); }
[Ignore] // vm.RefreshView() creates a timer that throws exceptions in background and breaks the test runner. public void RefreshViewTests() { var vm = new ProcessMetricsGadgetChartTabViewModel(); vm.Parent = new ProcessMetricsGadgetViewModel(); vm.Gadget.ProcessSystemName = "test"; vm.Gadget.SelectedFilter = null; var asyncResult = new AsyncSubject<IDataPortalResult>(); var typeManager = Mock.Create<IDynamicTypeManager>(Behavior.Loose); Mock.Arrange(() => typeManager.GetEditableRootType("test")).Returns(typeof(TestProcess)); Mock.Arrange(() => typeManager.BeginGetMetricAggregateInfo<IMetricAggregateInfoList>(Arg.IsAny<string>(), Arg.IsAny<Guid>(), Arg.IsAny<Guid>(), Arg.IsAny<string>())).Returns(asyncResult); asyncResult.OnNext(new DetailsViewModelTests.DataPortalResultStub()); asyncResult.OnCompleted(); vm.Gadget.TheDynamicTypeManager = typeManager; vm.Gadget.SelectedMetric = new Metric(1, "test", Guid.Empty, SummaryTypes.Avg, null, "PercentageMetricField", string.Empty, string.Empty, string.Empty, string.Empty, Guid.Empty, string.Empty, false); vm.RefreshView(); Assert.AreEqual("P2", vm.ResultFormat); }
public void SaveSettingsExecuteTests() { var vm = new ProcessMetricsGadgetChartTabViewModel(); vm.SaveSettings(new Dictionary<string, string> { { "MerticFilter", filterDefinition } }); }