LoadWorkflowInputs() public method

Used for loading all the inputs from the saved data or the data list
public LoadWorkflowInputs ( ) : void
return void
コード例 #1
0
 public void LoadInputs_Expected_Inputs_Loaded()
 {
     var mockResouce = GetMockResource();
     var serviceDebugInfo = GetMockServiceDebugInfo(mockResouce);
     serviceDebugInfo.SetupGet(s => s.ServiceInputData).Returns(StringResourcesTest.DebugInputWindow_XMLData);
     var workflowInputDataviewModel = new WorkflowInputDataViewModel(serviceDebugInfo.Object, CreateDebugOutputViewModel().SessionID);
     workflowInputDataviewModel.LoadWorkflowInputs();
     IList<IDataListItem> testDataListItems = GetInputTestDataDataNames();
     for(int i = 1; i < workflowInputDataviewModel.WorkflowInputs.Count; i++)
     {
         Assert.AreEqual(testDataListItems[i].DisplayValue, workflowInputDataviewModel.WorkflowInputs[i].DisplayValue);
         Assert.AreEqual(testDataListItems[i].Value, workflowInputDataviewModel.WorkflowInputs[i].Value);
     }
 }
コード例 #2
0
        public void SetWorkflowInputData_ExtraRows_Expected_Row_Available()
        {
            var mockResouce = GetMockResource();
            var serviceDebugInfo = GetMockServiceDebugInfo(mockResouce);
            serviceDebugInfo.SetupGet(s => s.ServiceInputData).Returns(StringResourcesTest.DebugInputWindow_XMLData);
            var workflowInputDataviewModel = new WorkflowInputDataViewModel(serviceDebugInfo.Object, CreateDebugOutputViewModel().SessionID);
            workflowInputDataviewModel.LoadWorkflowInputs();
            OptomizedObservableCollection<IDataListItem> inputValues = GetInputTestDataDataNames();

            // Cannot perform Collection Assert due to use of mocks for datalist items to remove dependancies during test
            for(int i = 0; i < workflowInputDataviewModel.WorkflowInputs.Count; i++)
            {
                Assert.AreEqual(inputValues[i].DisplayValue, workflowInputDataviewModel.WorkflowInputs[i].DisplayValue);
                Assert.AreEqual(inputValues[i].Value, workflowInputDataviewModel.WorkflowInputs[i].Value);
                Assert.AreEqual(inputValues[i].IsRecordset, workflowInputDataviewModel.WorkflowInputs[i].IsRecordset);
                Assert.AreEqual(inputValues[i].RecordsetIndex, workflowInputDataviewModel.WorkflowInputs[i].RecordsetIndex);
                Assert.AreEqual(inputValues[i].Field, workflowInputDataviewModel.WorkflowInputs[i].Field);
            }
        }
コード例 #3
0
        public void SetWorkflowInputData_AddRow_WhenNotAllColumnsInput_ExpectNewRowWithOnlyInputColumns()
        {
            //------------Setup for test--------------------------
            const string Shape = @"<DataList><rec Description="""" IsEditable=""True"" ColumnIODirection=""None"" ><a Description="""" IsEditable=""True"" ColumnIODirection=""Input"" /><b Description="""" IsEditable=""True"" ColumnIODirection=""None"" /></rec></DataList>";

            var rm = new Mock<IContextualResourceModel>();
            rm.Setup(r => r.ServerID).Returns(_serverID);
            rm.Setup(r => r.ResourceName).Returns(ResourceName);
            rm.Setup(r => r.WorkflowXaml).Returns(new StringBuilder(StringResourcesTest.DebugInputWindow_WorkflowXaml));
            rm.Setup(r => r.ID).Returns(_resourceID);
            rm.Setup(r => r.DataList).Returns(Shape);

            var serviceDebugInfoModel = new ServiceDebugInfoModel
            {
                DebugModeSetting = DebugMode.DebugInteractive,
                RememberInputs = true,
                ResourceModel = rm.Object,
                ServiceInputData = "xxxxx"
            };

            var debugVM = CreateDebugOutputViewModel();

            var itemToAdd = new DataListItem { DisplayValue = "rec(1).a", Field = "a", Recordset = "rec", IsRecordset = true, RecordsetIndex = "1", RecordsetIndexType = enRecordsetIndexType.Numeric, Value = "1" };

            //------------Execute Test---------------------------
            var workflowInputDataViewModel = new WorkflowInputDataViewModel(serviceDebugInfoModel, debugVM.SessionID);
            workflowInputDataViewModel.LoadWorkflowInputs();
            var inputs = workflowInputDataViewModel.WorkflowInputs;
            Assert.AreEqual(1, inputs.Count);
            inputs[0].Value = "1"; // trick it into thinking this happened from the UI ;)
            workflowInputDataViewModel.AddRow(itemToAdd);

            //------------Assert Results-------------------------
            inputs = workflowInputDataViewModel.WorkflowInputs;
            Assert.AreEqual(2, inputs.Count);
        }
コード例 #4
0
 public void Save_EmptyDataList_Expected_NoErrors()
 {
     var mockResouce = GetMockResource();
     mockResouce.SetupGet(s => s.DataList).Returns(string.Empty);
     var serviceDebugInfo = GetMockServiceDebugInfo(mockResouce);
     var workflowInputDataviewModel = new WorkflowInputDataViewModel(serviceDebugInfo.Object, CreateDebugOutputViewModel().SessionID);
     workflowInputDataviewModel.LoadWorkflowInputs();
     workflowInputDataviewModel.Save();
     Assert.AreEqual("", workflowInputDataviewModel.DebugTo.Error);
 }
コード例 #5
0
 public void LoadInputs_NullDataList_Expected_Blank_Inputs()
 {
     var mockResouce = GetMockResource();
     mockResouce.SetupGet(s => s.DataList).Returns(string.Empty);
     var serviceDebugInfo = GetMockServiceDebugInfo(mockResouce);
     var workflowInputDataviewModel = new WorkflowInputDataViewModel(serviceDebugInfo.Object, CreateDebugOutputViewModel().SessionID);
     workflowInputDataviewModel.LoadWorkflowInputs();
     Assert.IsTrue(workflowInputDataviewModel.WorkflowInputs.Count == 0);
 }
コード例 #6
0
 public void LoadInputs_BlankXMLData_Expected_Blank_Inputs()
 {
     var mockResouce = GetMockResource();
     var serviceDebugInfo = GetMockServiceDebugInfo(mockResouce);
     serviceDebugInfo.SetupGet(s => s.ServiceInputData).Returns("<DataList></DataList>");
     var workflowInputDataviewModel = new WorkflowInputDataViewModel(serviceDebugInfo.Object, CreateDebugOutputViewModel().SessionID);
     workflowInputDataviewModel.LoadWorkflowInputs();
     foreach(var input in workflowInputDataviewModel.WorkflowInputs)
     {
         Assert.AreEqual(string.Empty, input.Value);
     }
 }
コード例 #7
0
 public void Cancel_NullDataList_Expected_NoErrors()
 {
     var mockResouce = GetMockResource();
     var serviceDebugInfo = GetMockServiceDebugInfo(mockResouce);
     var workflowInputDataviewModel = new WorkflowInputDataViewModel(serviceDebugInfo.Object, CreateDebugOutputViewModel().SessionID);
     workflowInputDataviewModel.LoadWorkflowInputs();
     workflowInputDataviewModel.Cancel();
     Assert.AreEqual("", workflowInputDataviewModel.DebugTo.Error);
 }