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); } }
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); } }
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); }
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); }
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); }
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); } }
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); }