public void VerifyThatDummyWidgetIsAddedAutomatically()
        {
            var vm = new DashboardBrowserViewModel(this.iteration, this.session.Object, null, null, this.dialogNavigationService.Object, null);

            Assert.AreEqual(1, vm.Widgets.Count);
            Assert.IsInstanceOf <DummyParameterView>(vm.Widgets.First());
        }
        public void VerifyThatDragOverWorksWithParameter()
        {
            var vm = new DashboardBrowserViewModel(this.iteration, this.session.Object, null, null, null, null);

            var dropinfo = new Mock <IDropInfo>();

            dropinfo.Setup(x => x.Payload).Returns(this.elementDef.ContainedElement.First().ParameterOverride.First().Parameter);

            vm.DragOver(dropinfo.Object);

            dropinfo.VerifySet(x => x.Effects = DragDropEffects.Copy);
        }
        public async Task VerifyThatDropWorksWithParameterOverride()
        {
            var vm = new DashboardBrowserViewModel(this.iteration, this.session.Object, null, null, this.dialogNavigationService.Object, null);

            var dropinfo = new Mock <IDropInfo>();

            dropinfo.Setup(x => x.Payload).Returns(this.elementDef.ContainedElement.First().ParameterOverride.First());

            Assert.AreEqual(1, vm.Widgets.Count);

            await vm.Drop(dropinfo.Object);

            Assert.AreEqual(2, vm.Widgets.Count);
        }
        public async Task VerifyThatChartIsSizedCorrectly()
        {
            var vm = new DashboardBrowserViewModel(this.iteration, this.session.Object, null, null, this.dialogNavigationService.Object, null);

            vm.ActualWidth  = 1024;
            vm.ActualHeight = 768;

            //Initial, no Widgets
            Assert.AreEqual(vm.MainOrientation, Orientation.Vertical);
            Assert.AreEqual(vm.MaximizedElementPosition, MaximizedElementPosition.Top);

            var dropinfo = new Mock <IDropInfo>();

            dropinfo.Setup(x => x.Payload).Returns(this.elementDef.ContainedElement.First().ParameterOverride.First().Parameter);

            //Add widget
            await vm.Drop(dropinfo.Object);

            Assert.AreEqual(2, vm.Widgets.Count);

            //Set Widget maximized in LandScape
            var widget = vm.Widgets.OfType <IterationTrackParameterView>().First();
            var iterationTrackParameterViewModel = widget.DataContext as IterationTrackParameterViewModel <Parameter, ParameterValueSet>;

            iterationTrackParameterViewModel.ChartVisible = Visibility.Visible;

            Assert.AreEqual(vm.MainOrientation, Orientation.Horizontal);
            Assert.AreEqual(vm.MaximizedElementPosition, MaximizedElementPosition.Left);

            Assert.AreEqual(718, vm.MaximizedElement.Height);
            Assert.AreEqual(724, vm.MaximizedElement.Width);

            //Set Portrait mode
            vm.ActualWidth  = 768;
            vm.ActualHeight = 1024;

            Assert.AreEqual(vm.MainOrientation, Orientation.Vertical);
            Assert.AreEqual(vm.MaximizedElementPosition, MaximizedElementPosition.Top);

            Assert.AreEqual(774, vm.MaximizedElement.Height);
            Assert.AreEqual(718, vm.MaximizedElement.Width);

            //Add another Widget
            var dropinfo2 = new Mock <IDropInfo>();

            dropinfo2.Setup(x => x.Payload).Returns(this.elementDef.ContainedElement.First().ParameterOverride.First());

            await vm.Drop(dropinfo2.Object);

            Assert.AreEqual(3, vm.Widgets.Count);

            //Maximize the new widget's chart
            var widget2 = vm.Widgets.OfType <IterationTrackParameterView>().First(x => x.DataContext is IterationTrackParameterViewModel <ParameterOverride, ParameterOverrideValueSet>);
            var iterationTrackParameterViewModel2 = widget2.DataContext as IterationTrackParameterViewModel <ParameterOverride, ParameterOverrideValueSet>;

            iterationTrackParameterViewModel2.ChartVisible = Visibility.Visible;

            Assert.AreEqual(widget2, vm.MaximizedElement);

            Assert.AreEqual(200, widget.Height);
            Assert.AreEqual(250, widget.Width);

            Assert.AreEqual(774, widget2.Height);
            Assert.AreEqual(718, widget2.Width);
        }