public void WorkflowDesignerViewModel_ExpandAllCommand_True_RequestExpandAll() { //----------------------- Setup -----------------------// var workflow = new ActivityBuilder { Implementation = new Flowchart { StartNode = CreateFlowNode(Guid.NewGuid(), "CanSaveTest", true, typeof(TestActivity)) } }; #region Setup viewModel var resourceRep = new Mock<IResourceRepository>(); resourceRep.Setup(r => r.All()).Returns(new List<IResourceModel>()); resourceRep.Setup(r => r.FetchResourceDefinition(It.IsAny<IEnvironmentModel>(), It.IsAny<Guid>(), It.IsAny<Guid>(), It.IsAny<bool>())).Returns(new ExecuteMessage()); var resourceModel = new Mock<IContextualResourceModel>(); resourceModel.Setup(m => m.Environment.ResourceRepository).Returns(resourceRep.Object); resourceModel.Setup(model => model.ResourceName).Returns("Some workflow 332"); var workflowHelper = new Mock<IWorkflowHelper>(); workflowHelper.Setup(h => h.CreateWorkflow(It.IsAny<string>())).Returns(workflow); var viewModel = new WorkflowDesignerViewModelMock(resourceModel.Object, workflowHelper.Object); viewModel.InitializeDesigner(new Dictionary<Type, Type>()); viewModel.SetupRequestExapandAll(); #endregion const bool ExpectedCanSave = true; resourceModel.Setup(m => m.IsAuthorized(AuthorizationContext.Contribute)).Returns(ExpectedCanSave).Verifiable(); //----------------------- Execute -----------------------// Assert.IsFalse(viewModel.RequestedExpandAll); viewModel.ExpandAllCommand.Execute(true); viewModel.Dispose(); //----------------------- Assert -----------------------// Assert.IsTrue(viewModel.RequestedExpandAll); }