コード例 #1
0
        public void ProcessKpiListGadgetViewModelConstructorTests()
        {
            var vm = new ProcessKpiListGadgetViewModel();

            Assert.IsTrue(vm.AutoSaveProperties.Contains("SelectedKPIs"));

            Assert.IsFalse(vm.AutoSaveProperties.Contains("NonExistentProperty"));
        }
コード例 #2
0
        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();
        }
コード例 #3
0
 /// <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;
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        public void NotifyPropertyChangedTests()
        {
            var vm = new ProcessKpiListGadgetViewModel();

            TestsHelper.TestPropertyWithNotifyPropertyChanged(vm, () => vm.SelectedKPIs);
        }
コード例 #6
0
        public void KpiListGadgetMustHaveDescriptionLabel()
        {
            // arrange, act
            var vm = new ProcessKpiListGadgetViewModel();

            Assert.AreEqual("KPI List", vm.ItemName);
        }