public void ProcessKpiListGadgetViewModelConstructorTests() { var vm = new ProcessKpiListGadgetViewModel(); Assert.IsTrue(vm.AutoSaveProperties.Contains("SelectedKPIs")); Assert.IsFalse(vm.AutoSaveProperties.Contains("NonExistentProperty")); }
public void SaveSettingsExecuteTests() { var vm = new ProcessKpiListGadgetViewModel(); var saveWasFired = false; Mock.NonPublic.Arrange(vm, "RaisePropertyChanged", ArgExpr.IsAny<string>()).CallOriginal(); vm.RequestSave += (o, e) => { saveWasFired = true; }; EnqueueConditional(() => saveWasFired); EnqueueCallback(() => Assert.IsTrue(saveWasFired)); vm.SelectedKPIs = new List<IKpi>(); Mock.NonPublic.Assert(vm, "RaisePropertyChanged", Occurs.Once(), ArgExpr.IsAny<string>()); EnqueueTestComplete(); }
/// <summary> /// Initializes a new instance of the <see cref="KpiSelectorViewModel"/> class. /// </summary> /// <param name="kpi">The kpi.</param> /// <param name="parent">The parent.</param> public KpiSelectorViewModel(IKpi kpi, ProcessKpiListGadgetViewModel parent) { _kpi = kpi; _parent = parent; }
public void LoadSettingsExecuteTests() { var kpiGuid = Guid.NewGuid(); var vm = new ProcessKpiListGadgetViewModel { PublishedProcessFactory = null, TheDynamicTypeManager = Mock.Create<IDynamicTypeManager>(Behavior.Loose), TabsFactory = new List<ExportFactory<IGadgetTabViewModel, IExportAsGadgetTabViewModelAttributeMetadata>>(), TheEventAggregator = Mock.Create<IEventAggregator>(Behavior.Loose) }; vm.KPIs.Add(new KpiSelectorViewModel(new Kpi(1, "kpi", kpiGuid, FavorableDirections.Up, 0.00, 1.00, string.Empty, null, 0.50, string.Empty, null, string.Empty, null, Guid.NewGuid(), string.Empty), vm)); var settings = new Dictionary<string, string> { { "SelectedKPIs", kpiGuid.ToString() } }; // act vm.Init(new Gadget(), Guid.NewGuid(), "name", settings); // assert Assert.AreEqual(kpiGuid, vm.SelectedKPIs[0].Guid); }
public void NotifyPropertyChangedTests() { var vm = new ProcessKpiListGadgetViewModel(); TestsHelper.TestPropertyWithNotifyPropertyChanged(vm, () => vm.SelectedKPIs); }
public void KpiListGadgetMustHaveDescriptionLabel() { // arrange, act var vm = new ProcessKpiListGadgetViewModel(); Assert.AreEqual("KPI List", vm.ItemName); }