Ejemplo n.º 1
0
        public void ActivityDesignerViewModel_Collapse_HelpButtonGetsRemovedOnCollapse()
        {
            //------------Setup for test--------------------------
            var mockModelItem          = GenerateMockModelItem();
            var setupResourceModelMock = Dev2MockFactory.SetupResourceModelMock();
            var errorInfo = new ErrorInfo {
                InstanceID = new Guid()
            };

            var envRepo = new Mock <IServerRepository>();

            envRepo.Setup(e => e.ActiveServer).Returns(setupResourceModelMock.Object.Environment);

            IObservableReadOnlyList <IErrorInfo> testErrors = new ObservableReadOnlyList <IErrorInfo> {
                errorInfo
            };

            setupResourceModelMock.Setup(c => c.Errors).Returns(testErrors);
            setupResourceModelMock.Setup(c => c.GetErrors(It.IsAny <Guid>())).Returns(new List <IErrorInfo> {
                errorInfo
            });
            var viewModel = new ServiceDesignerViewModel(mockModelItem.Object, setupResourceModelMock.Object, envRepo.Object, new Mock <IEventAggregator>().Object, new SynchronousAsyncWorker());

            Assert.AreEqual(1, viewModel.TitleBarToggles.Count);

            viewModel.ShowLarge = true;

            Assert.AreEqual(1, viewModel.TitleBarToggles.Count);

            //------------Execute Test---------------------------
            viewModel.Collapse();

            //------------Assert Results-------------------------
            Assert.AreEqual(1, viewModel.TitleBarToggles.Count);
        }
        public void ActivityDesignerViewModel_Collapse_HelpButtonGetsRemovedOnCollapse()
        {
            //------------Setup for test--------------------------
            var mockModelItem = GenerateMockModelItem();
            Mock<IContextualResourceModel> setupResourceModelMock = Dev2MockFactory.SetupResourceModelMock();
            ErrorInfo errorInfo = new ErrorInfo { InstanceID = new Guid() };

            var envRepo = new Mock<IEnvironmentRepository>();
            envRepo.Setup(e => e.ActiveEnvironment).Returns(setupResourceModelMock.Object.Environment);

            IObservableReadOnlyList<IErrorInfo> testErrors = new ObservableReadOnlyList<IErrorInfo> { errorInfo };
            setupResourceModelMock.Setup(c => c.Errors).Returns(testErrors);
            setupResourceModelMock.Setup(c => c.GetErrors(It.IsAny<Guid>())).Returns(new List<IErrorInfo> { errorInfo });
            var viewModel = new ServiceDesignerViewModel(mockModelItem.Object, setupResourceModelMock.Object, envRepo.Object, new Mock<IEventAggregator>().Object, new TestAsyncWorker());

            Assert.AreEqual(1, viewModel.TitleBarToggles.Count);

            viewModel.ShowLarge = true;

            Assert.AreEqual(2, viewModel.TitleBarToggles.Count);

            //------------Execute Test---------------------------
            viewModel.Collapse();

            //------------Assert Results-------------------------
            Assert.AreEqual(1, viewModel.TitleBarToggles.Count);
        }