コード例 #1
0
        static TestZipDesignerViewModel ZipViewModel()
        {
            var viewModel = new TestZipDesignerViewModel(ModelItemUtils.CreateModelItem(new DsfZip()));

            return(viewModel);
        }
コード例 #2
0
        public void DatabaseInputRegion_Test_InputAddHeader_ExpectHeightChangesPastThree()
        {
            var id  = Guid.NewGuid();
            var act = new DsfSqlServerDatabaseActivity()
            {
                SourceId = id
            };
            var src = new Mock <IDbServiceModel>();

            src.Setup(a => a.RetrieveSources()).Returns(new ObservableCollection <IDbSource>());
            DatabaseSourceRegion sourceRegion   = new DatabaseSourceRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfSqlServerDatabaseActivity()), enSourceType.SqlDatabase);
            DbActionRegion       dbActionRegion = new DbActionRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfSqlServerDatabaseActivity()), sourceRegion, new SynchronousAsyncWorker());

            var region = new DatabaseInputRegion(ModelItemUtils.CreateModelItem(act), dbActionRegion);

            Assert.AreEqual(region.IsEnabled, false);
        }
コード例 #3
0
        public void DatabaseInputRegion_SourceChanged_UpdateValues()
        {
            //------------Setup for test--------------------------
            var id  = Guid.NewGuid();
            var act = new DsfSqlServerDatabaseActivity()
            {
                SourceId = id
            };
            var src = new Mock <IDbServiceModel>();
            var lst = new ObservableCollection <IDbSource>()
            {
                new DbSourceDefinition()
                {
                    Name = "bravo"
                }, new DbSourceDefinition()
                {
                    Name = "johnny"
                }
            };

            src.Setup(a => a.RetrieveSources()).Returns(lst);
            DatabaseSourceRegion sourceRegion   = new DatabaseSourceRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfSqlServerDatabaseActivity()), enSourceType.SqlDatabase);
            DbActionRegion       dbActionRegion = new DbActionRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfSqlServerDatabaseActivity()), sourceRegion, new SynchronousAsyncWorker());

            var region = new DatabaseInputRegion(ModelItemUtils.CreateModelItem(act), dbActionRegion);

            sourceRegion.SelectedSource = lst[0];
            Assert.AreEqual(region.Inputs.Count, 0);
        }
コード例 #4
0
 static ModelItem CreateModelItem()
 {
     return(ModelItemUtils.CreateModelItem(new DsfCountRecordsetActivity()));
 }
コード例 #5
0
 static ModelItem CreateModelItem()
 {
     return(ModelItemUtils.CreateModelItem(new DsfDateTimeDifferenceActivity()));
 }
コード例 #6
0
        public void GivenIOpenWorkflowWithODBC()
        {
            var sourceId = Guid.NewGuid();
            var inputs   = new List <IServiceInput> {
                new ServiceInput("Prefix", "[[Prefix]]")
            };
            var outputs = new List <IServiceOutputMapping>
            {
                new ServiceOutputMapping("CountryID", "CountryID", "dbo_Pr_CitiesGetCountries"),
                new ServiceOutputMapping("Description", "Description", "dbo_Pr_CitiesGetCountries")
            };

            var odbcServerActivity = new DsfODBCDatabaseActivity
            {
                SourceId    = sourceId,
                CommandText = "dbo.Pr_CitiesGetCountries",
                Inputs      = inputs,
                Outputs     = outputs
            };
            var modelItem = ModelItemUtils.CreateModelItem(odbcServerActivity);

            var mockServiceInputViewModel  = new Mock <IManageServiceInputViewModel>();
            var mockDatabaseInputViewModel = new Mock <IManageDatabaseInputViewModel>();
            var mockDbServiceModel         = new Mock <IDbServiceModel>();
            var mockEnvironmentRepo        = new Mock <IServerRepository>();
            var mockEnvironmentModel       = new Mock <IServer>();

            mockEnvironmentModel.Setup(model => model.IsConnected).Returns(true);
            mockEnvironmentModel.Setup(model => model.IsLocalHost).Returns(true);
            mockEnvironmentModel.Setup(model => model.EnvironmentID).Returns(Guid.Empty);
            mockEnvironmentModel.Setup(model => model.IsLocalHostCheck()).Returns(false);
            mockEnvironmentRepo.Setup(repository => repository.ActiveServer).Returns(mockEnvironmentModel.Object);
            mockEnvironmentRepo.Setup(repository => repository.FindSingle(It.IsAny <Expression <Func <IServer, bool> > >())).Returns(mockEnvironmentModel.Object);

            _greenPointSource = new DbSourceDefinition
            {
                Name = "GreenPoint",
                Type = enSourceType.ODBC
            };

            _testingDbSource = new DbSourceDefinition
            {
                Name = "testingDBSrc",
                Type = enSourceType.ODBC,
                Id   = sourceId
            };

            _importOrderAction = new DbAction
            {
                Name   = "dbo.ImportOrder",
                Inputs = new List <IServiceInput> {
                    new ServiceInput("ProductId", "")
                }
            };

            _getCountriesAction = new DbAction {
                Name = "dbo.Pr_CitiesGetCountries"
            };
            _getCountriesAction.Inputs = inputs;
            var dbSources = new ObservableCollection <IDbSource> {
                _testingDbSource, _greenPointSource
            };

            mockDbServiceModel.Setup(model => model.RetrieveSources()).Returns(dbSources);
            mockDbServiceModel.Setup(model => model.GetActions(It.IsAny <IDbSource>())).Returns(new List <IDbAction> {
                _getCountriesAction, _importOrderAction
            });
            mockServiceInputViewModel.SetupAllProperties();

            var mockAction   = new Mock <Action>(MockBehavior.Default);
            var mockOkAction = new Mock <Action>(MockBehavior.Default);

            mockDatabaseInputViewModel.Setup(model => model.TestAction).Returns(mockAction.Object);
            mockDatabaseInputViewModel.Setup(model => model.OkAction).Returns(mockOkAction.Object);
            var odbcDatabaseDesignerViewModel = new ODBCDatabaseDesignerViewModel(modelItem, mockDbServiceModel.Object);

            ScenarioContext.Current.Add("ViewModel", odbcDatabaseDesignerViewModel);
            ScenarioContext.Current.Add("mockDatabaseInputViewModel", mockDatabaseInputViewModel);
            ScenarioContext.Current.Add("mockDbServiceModel", mockDbServiceModel);
        }
コード例 #7
0
        public static MultiAssignObjectDesignerViewModel CreateDsfMultiAssignObjectActivityViewModel()
        {
            if (CustomContainer.Get <IShellViewModel>() == null)
            {
                CustomContainer.Register(new Mock <IShellViewModel>().Object);
            }
            var dsfMultiAssignObjectActivityViewModel = new MultiAssignObjectDesignerViewModel(ModelItemUtils.CreateModelItem(new DsfMultiAssignObjectActivity()));

            return(dsfMultiAssignObjectActivityViewModel);
        }
コード例 #8
0
        public void QuickVariableInputViewModel_PreviewCommand_WhenItemsHaveValues_ShouldResetValues()
        {
            //------------Setup for test--------------------------
            var quickVariableInputViewModel = new QuickVariableInputViewModel(new QuickVariableInputModel(ModelItemUtils.CreateModelItem(), null));

            //------------Execute Test---------------------------
            quickVariableInputViewModel.SplitType  = "Space";
            quickVariableInputViewModel.SplitToken = "-";

            quickVariableInputViewModel.PreviewCommand.Execute(null);
            //------------Assert Results-------------------------
            Assert.AreEqual("Space", quickVariableInputViewModel.SplitType);
            Assert.AreEqual("-", quickVariableInputViewModel.SplitToken);
        }
コード例 #9
0
        public void RabbitMQPublishDesignerViewModel2_EditRabbitMQSourceCommand_ExistingSourceId()
        {
            //------------Setup for test--------------------------
            CustomContainer.LoadedTypes = new List <Type>
            {
                typeof(ManageRabbitMQSourceModel)
            };

            var mockHelpViewModel = new Mock <IHelpWindowViewModel>();

            mockHelpViewModel.Setup(model => model.UpdateHelpText(It.IsAny <string>())).Verifiable();

            var mockUpdateManager = new Mock <IStudioUpdateManager>();
            var mockQueryManager  = new Mock <IQueryManager>();

            var guidOne = Guid.NewGuid();
            var guidTwo = Guid.NewGuid();

            var rabbitMqSourceOne = new RabbitMQSource {
                ResourceID = guidOne, ResourceName = "ResourceOne", HostName = "HostOne"
            };
            var rabbitMqSourceTwo = new RabbitMQSource {
                ResourceID = guidTwo, ResourceName = "ResourceTwo", HostName = "HostTwo"
            };
            var rabbitMqServiceSourceDefinitionOne = new RabbitMQServiceSourceDefinition(rabbitMqSourceOne);
            var rabbitMqServiceSourceDefinitionTwo = new RabbitMQServiceSourceDefinition(rabbitMqSourceTwo);

            var rabbitMqServiceSourceDefinitions = new List <IRabbitMQServiceSourceDefinition>
            {
                rabbitMqServiceSourceDefinitionOne,
                rabbitMqServiceSourceDefinitionTwo,
            };

            mockQueryManager.Setup(o => o.FetchRabbitMQServiceSources()).Returns(rabbitMqServiceSourceDefinitions);

            var server = new Mock <IServer>();

            server.Setup(server1 => server1.UpdateRepository).Returns(mockUpdateManager.Object);
            server.Setup(server1 => server1.QueryProxy).Returns(mockQueryManager.Object);

            var mockMainViewModel = new Mock <IShellViewModel>();

            mockMainViewModel.Setup(model => model.HelpViewModel).Returns(mockHelpViewModel.Object);
            mockMainViewModel.Setup(model => model.ActiveServer).Returns(server.Object);
            CustomContainer.Register(mockMainViewModel.Object);

            var publishRabbitMqActivity = new PublishRabbitMQActivity();
            //------------Execute Test---------------------------
            var vm = new RabbitMQPublishDesignerViewModel2(ModelItemUtils.CreateModelItem(publishRabbitMqActivity));

            //------------Execute Test---------------------------

            vm.SelectedRabbitMQSource = rabbitMqServiceSourceDefinitionOne;

            Assert.IsTrue(vm.EditRabbitMQSourceCommand.CanExecute(null));

            vm.EditRabbitMQSourceCommand.Execute(null);

            //------------Assert Results-------------------------
            Assert.AreEqual(rabbitMqServiceSourceDefinitionOne, vm.SelectedRabbitMQSource);
        }
コード例 #10
0
        public void QuickVariableInputViewModel_CancelCommand_ClearData_ShouldResetValues()
        {
            //------------Setup for test--------------------------
            var quickVariableInputViewModel = new QuickVariableInputViewModel(new QuickVariableInputModel(ModelItemUtils.CreateModelItem(), null));

            //------------Execute Test---------------------------
            quickVariableInputViewModel.SplitType  = "Space";
            quickVariableInputViewModel.SplitToken = "-";

            quickVariableInputViewModel.CancelCommand.Execute(null);
            //------------Assert Results-------------------------
            Assert.AreEqual("Chars", quickVariableInputViewModel.SplitType);
            Assert.AreEqual("", quickVariableInputViewModel.SplitToken);
        }
コード例 #11
0
        public void QuickVariableInputViewModel_AddCommand_Chars_ShouldPass()
        {
            //------------Setup for test--------------------------
            var quickVariableInputViewModel = new QuickVariableInputViewModel(new QuickVariableInputModel(ModelItemUtils.CreateModelItem(), null));

            //------------Execute Test---------------------------
            quickVariableInputViewModel.SplitType  = "Chars";
            quickVariableInputViewModel.SplitToken = "";
            quickVariableInputViewModel.MakeDataListReady(new List <string> {
                "Test 1", "Test 4", "T e s t"
            });

            quickVariableInputViewModel.AddCommand.Execute(null);
            //------------Assert Results-------------------------
            Assert.AreEqual("Chars", quickVariableInputViewModel.SplitType);
            Assert.AreEqual("", quickVariableInputViewModel.SplitToken);
        }
コード例 #12
0
        public void QuickVariableInputViewModel_Construct_SetProperties_ShouldSetCorrectProperties()
        {
            //------------Setup for test--------------------------
            var quickVariableInputViewModel = new QuickVariableInputViewModel(new QuickVariableInputModel(ModelItemUtils.CreateModelItem(), null));

            //------------Execute Test---------------------------

            var list = new List <string> {
                "Index", "Chars", "New Line", "Space", "Tab"
            };

            //------------Assert Results-------------------------
            Assert.AreEqual("Chars", quickVariableInputViewModel.SplitType);
            Assert.AreEqual("", quickVariableInputViewModel.SplitToken);
            Assert.IsFalse(quickVariableInputViewModel.CanAdd);
            Assert.AreEqual(list.Count, quickVariableInputViewModel.SplitTypeList.Count);
        }
コード例 #13
0
        public void QuickVariableInputViewModel_MakeDataListReady_WhenItemsHaveSpaces_ShouldRemoveSpaces()
        {
            //------------Setup for test--------------------------
            var quickVariableInputViewModel = new QuickVariableInputViewModel(new QuickVariableInputModel(ModelItemUtils.CreateModelItem(), null));

            //------------Execute Test---------------------------
            var makeDataListReady = quickVariableInputViewModel.MakeDataListReady(new List <string> {
                "Test 1", "Test 4", "T e s t"
            });

            //------------Assert Results-------------------------
            Assert.AreEqual(3, makeDataListReady.Count);
            Assert.AreEqual("[[Test1]]", makeDataListReady[0]);
            Assert.AreEqual("[[Test4]]", makeDataListReady[1]);
            Assert.AreEqual("[[Test]]", makeDataListReady[2]);
        }
コード例 #14
0
        static TestWriteFileDesignerViewModel WriteFileViewModel()
        {
            var viewModel = new TestWriteFileDesignerViewModel(ModelItemUtils.CreateModelItem(new DsfFileWrite()));

            return(viewModel);
        }
コード例 #15
0
 static ModelItem CreateModelItem(string commandFileName = null)
 {
     return(ModelItemUtils.CreateModelItem(new DsfExecuteCommandLineActivity {
         CommandFileName = commandFileName
     }));
 }
コード例 #16
0
 static ModelItem CreateModelItem()
 {
     return(ModelItemUtils.CreateModelItem(new PublishRabbitMQActivity()));
 }
コード例 #17
0
        public static CreateJsonDesignerViewModel CreateViewModel(DsfCreateJsonActivity activity)
        {
            var createJsonDesignerViewModel = new CreateJsonDesignerViewModel(ModelItemUtils.CreateModelItem(activity));

            return(createJsonDesignerViewModel);
        }
コード例 #18
0
        public void ComActionRegion_ChangeSelectedAction_Scenerio_Result()
        {
            //------------Setup for test--------------------------
            var id  = Guid.NewGuid();
            var act = new DsfComDllActivity {
                SourceId = id
            };
            var src       = new Mock <IComPluginServiceModel>();
            var dotNetsrc = new ComPluginSourceDefinition {
                Id = id, ResourceName = "johnny"
            };
            var action = new PluginAction {
                FullName = "bravo", Method = "bravo", ReturnType = typeof(string), Variables = new List <INameValue>()
            };
            var action2 = new PluginAction {
                FullName = "simpson", Method = "simpson", ReturnType = typeof(string), Variables = new List <INameValue>()
            };

            src.Setup(a => a.RetrieveSources()).Returns(new ObservableCollection <IComPluginSource>()
            {
                dotNetsrc
            });

            var sourceRegion = new ComSourceRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfComDllActivity()));

            sourceRegion.SelectedSource = dotNetsrc;

            var namespaceItem = new NamespaceItem {
                FullName = "johnny"
            };
            var comNamespaceRegion = new ComNamespaceRegion(src.Object, ModelItemUtils.CreateModelItem(act), sourceRegion);

            comNamespaceRegion.SelectedNamespace = namespaceItem;

            //------------Execute Test---------------------------
            var dotNetActionRegion = new ComActionRegion(src.Object, ModelItemUtils.CreateModelItem(act), sourceRegion, comNamespaceRegion);

            dotNetActionRegion.SelectedAction = action;

            //------------Assert Results-------------------------
            Assert.AreEqual(action, dotNetActionRegion.SelectedAction);
            Assert.AreEqual(action.FullName, dotNetActionRegion.SelectedAction.FullName);
            Assert.AreEqual(action.Method, dotNetActionRegion.SelectedAction.Method);
            Assert.AreEqual(typeof(string), dotNetActionRegion.SelectedAction.ReturnType);
            Assert.AreEqual(0, dotNetActionRegion.SelectedAction.Variables.Count);
            Assert.IsTrue(dotNetActionRegion.CanRefresh());

            dotNetActionRegion.SelectedAction = action2;
            Assert.AreEqual(action2, dotNetActionRegion.SelectedAction);
            Assert.AreEqual(action2.FullName, dotNetActionRegion.SelectedAction.FullName);
            Assert.AreEqual(action2.Method, dotNetActionRegion.SelectedAction.Method);
            Assert.AreEqual(typeof(string), dotNetActionRegion.SelectedAction.ReturnType);
            Assert.AreEqual(0, dotNetActionRegion.SelectedAction.Variables.Count);
            Assert.IsTrue(dotNetActionRegion.CanRefresh());

            dotNetActionRegion.SelectedAction = action;
            Assert.AreEqual(action, dotNetActionRegion.SelectedAction);
            Assert.AreEqual(action.FullName, dotNetActionRegion.SelectedAction.FullName);
            Assert.AreEqual(action.Method, dotNetActionRegion.SelectedAction.Method);
            Assert.AreEqual(typeof(string), dotNetActionRegion.SelectedAction.ReturnType);
            Assert.AreEqual(0, dotNetActionRegion.SelectedAction.Variables.Count);
            Assert.IsTrue(dotNetActionRegion.CanRefresh());
        }
コード例 #19
0
 static ModelItem CreateModelItem()
 {
     return(ModelItemUtils.CreateModelItem(new DsfRubyActivity()));
 }
コード例 #20
0
        static ModelItem CreateModelItem()
        {
            var readListActivity = new SharepointReadListActivity();

            return(ModelItemUtils.CreateModelItem(readListActivity));
        }
コード例 #21
0
        public void GivenIDragWebGetRequestConnectorToolOntoTheDesignSurface()
        {
            var activity  = new DsfWebGetActivity();
            var modelItem = ModelItemUtils.CreateModelItem(activity);
            var mockServiceInputViewModel = new Mock <IManageWebServiceInputViewModel>();
            var mockServiceModel          = new Mock <IWebServiceModel>();
            var mockEnvironmentRepo       = new Mock <IServerRepository>();
            var mockEnvironmentModel      = new Mock <IServer>();

            mockEnvironmentModel.Setup(model => model.IsConnected).Returns(true);
            mockEnvironmentModel.Setup(model => model.IsLocalHost).Returns(true);
            mockEnvironmentModel.Setup(model => model.EnvironmentID).Returns(Guid.Empty);
            mockEnvironmentModel.Setup(model => model.IsLocalHostCheck()).Returns(false);
            mockEnvironmentRepo.Setup(repository => repository.ActiveServer).Returns(mockEnvironmentModel.Object);
            mockEnvironmentRepo.Setup(repository => repository.FindSingle(It.IsAny <Expression <Func <IServer, bool> > >())).Returns(mockEnvironmentModel.Object);

            _otherwebsource = new WebServiceSourceDefinition
            {
                Name     = "OtherWebSource",
                HostName = @"http://www.google.com",
                Id       = Guid.NewGuid()
            };


            _weblocalhostsource = new WebServiceSourceDefinition
            {
                Name     = "LocalhostSource",
                HostName = @"http://rsaklfsvrtfsbld:9810/api/products/Get",
                Id       = Guid.NewGuid()
            };

            var webService = new WebService
            {
                RequestResponse = "[{\"Category\":\"Electronic\",\"Id\":\"1\",\"Name\":\"Television\",\"Price\":\"82000\"},{\"Category\":\"Electronic\",\"Id\":\"2\",\"Name\":\"Refrigerator\",\"Price\":\"23000\"},{\"Category\":\"Electronic\",\"Id\":\"3\",\"Name\":\"Mobiles\",\"Price\":\"20000\"},{\"Category\":\"Electronic\",\"Id\":\"4\",\"Name\":\"Laptops\",\"Price\":\"45000\"},{\"Category\":\"Electronic\",\"Id\":\"5\",\"Name\":\"iPads\",\"Price\":\"67000\"},{\"Category\":\"Gift Items\",\"Id\":\"6\",\"Name\":\"Toys\",\"Price\":\"15000\"}]",
                Recordsets      = new RecordsetList
                {
                    new Dev2.Runtime.ServiceModel.Data.Recordset
                    {
                        Name   = "UnnamedArrayData",
                        Fields = new List <RecordsetField>
                        {
                            new RecordsetField
                            {
                                Alias          = "Id",
                                Name           = "Id",
                                RecordsetAlias = ""
                            },
                            new RecordsetField
                            {
                                Alias          = "Name",
                                Name           = "Name",
                                RecordsetAlias = ""
                            },
                            new RecordsetField
                            {
                                Alias          = "Category",
                                Name           = "Category",
                                RecordsetAlias = ""
                            },
                            new RecordsetField
                            {
                                Alias          = "Price",
                                Name           = "Price",
                                RecordsetAlias = ""
                            }
                        }
                    }
                }
            };
            var serializer = new Dev2JsonSerializer();
            var testResult = serializer.Serialize(webService);

            var sources = new ObservableCollection <IWebServiceSource> {
                _weblocalhostsource, _otherwebsource
            };

            mockServiceModel.Setup(model => model.RetrieveSources()).Returns(sources);
            mockServiceModel.Setup(model => model.Sources).Returns(sources);
            mockServiceModel.Setup(model => model.EditSource(It.IsAny <IWebServiceSource>())).Verifiable();
            mockServiceInputViewModel.SetupAllProperties();
            mockServiceModel.Setup(model => model.TestService(It.IsAny <IWebService>())).Returns(testResult);
            var viewModel = new WebServiceGetViewModel(modelItem, mockServiceModel.Object);

            scenarioContext.Add("viewModel", viewModel);
            scenarioContext.Add("mockServiceInputViewModel", mockServiceInputViewModel);
            scenarioContext.Add("mockServiceModel", mockServiceModel);
        }
コード例 #22
0
 static ModelItem CreateModelItem()
 {
     return(ModelItemUtils.CreateModelItem(new DsfNumberFormatActivity()));
 }
コード例 #23
0
 static ModelItem CreateModelItem()
 {
     return(ModelItemUtils.CreateModelItem(new DsfSortRecordsActivity()));
 }
コード例 #24
0
        public void WebPostActivityViewModel_TestInputCommand_IsFormDataChecked()
        {
            //---------------Set up test pack-------------------
            var mockModel    = GetMockModel();
            var postActivity = GetPostActivityWithOutPuts(mockModel);

            var postViewModel = new WebPostActivityViewModel(ModelItemUtils.CreateModelItem(postActivity), mockModel);

            postViewModel.ManageServiceInputViewModel = new InputViewForWebPostTest(postViewModel, mockModel);
            postViewModel.SourceRegion.SelectedSource = postViewModel.SourceRegion.Sources.First();
            postViewModel.InputArea.Headers.Add(new NameValue("[[a]]", "asa"));
            postViewModel.InputArea.ViewModel                = new WebPostActivityViewModelNew(ModelItemUtils.CreateModelItem(postActivity), mockModel);
            postViewModel.InputArea.IsFormDataChecked        = true;
            postViewModel.ConditionExpressionOptions.Options = new List <IOption>
            {
                new FormDataOptionConditionExpression
                {
                    Key   = "l",
                    Value = "r",
                    Cond  = new FormDataConditionText
                    {
                        TableType = enFormDataTableType.Text,
                        Value     = "this can be any text message"
                    },
                }
            };
            //---------------Execute Test ----------------------
            postViewModel.TestInputCommand.Execute();
            postViewModel.ManageServiceInputViewModel.TestCommand.Execute(null);
            postViewModel.ManageServiceInputViewModel.IsEnabled          = true;
            postViewModel.ManageServiceInputViewModel.OutputArea.Outputs = new List <IServiceOutputMapping> {
                new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("a", "b", "c")
            };
            postViewModel.ManageServiceInputViewModel.OkCommand.Execute(null);

            //---------------Test Result -----------------------
            Assert.IsTrue(postViewModel.SourceRegion.IsEnabled);
            Assert.IsTrue(postViewModel.OutputsRegion.IsEnabled);
            Assert.IsTrue(postViewModel.InputArea.IsEnabled);
            Assert.IsTrue(postViewModel.ErrorRegion.IsEnabled);
            Assert.AreEqual(1, postViewModel.ManageServiceInputViewModel.InputArea.Inputs.Count);
            Assert.IsTrue(postViewModel.ManageServiceInputViewModel.InputArea.Inputs.First().Name == "[[a]]");
            Assert.AreEqual(0, postViewModel.ManageServiceInputViewModel.Errors.Count);
            Assert.IsTrue(postViewModel.ManageServiceInputViewModel.IsFormDataChecked);

            var options = postViewModel.ManageServiceInputViewModel.ConditionExpressionOptions.Options;

            Assert.IsTrue(options.Count == 2);
            var item1 = options.First() as FormDataOptionConditionExpression;

            Assert.IsNotNull(item1);
            Assert.AreEqual("l", item1.Key);
            Assert.AreEqual("r", item1.Value);
            Assert.AreEqual(enFormDataTableType.Text, item1.Cond.TableType);
            Assert.AreEqual("this can be any text message", (item1.Cond as FormDataConditionText)?.Value);
        }
コード例 #25
0
        private ModelItem CreateModelItem()
        {
            var fileUploadactivity = new SharepointFileUploadActivity();

            return(ModelItemUtils.CreateModelItem(fileUploadactivity));
        }
コード例 #26
0
 WebPostActivityViewModel GetWebPostActivityViewModel()
 {
     return(new WebPostActivityViewModel(ModelItemUtils.CreateModelItem(GetEmptyPostActivity(), GetMockModel())));
 }
コード例 #27
0
        public void DatabaseInputRegion_RestoreFromPrevious_Restore_ExpectValuesChanged()
        {
            //------------Setup for test--------------------------
            var id  = Guid.NewGuid();
            var act = new DsfSqlServerDatabaseActivity()
            {
                SourceId = id
            };
            var src = new Mock <IDbServiceModel>();

            src.Setup(a => a.RetrieveSources()).Returns(new ObservableCollection <IDbSource>());
            DatabaseSourceRegion sourceRegion   = new DatabaseSourceRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfSqlServerDatabaseActivity()), enSourceType.SqlDatabase);
            DbActionRegion       dbActionRegion = new DbActionRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfSqlServerDatabaseActivity()), sourceRegion, new SynchronousAsyncWorker());

            var region = new DatabaseInputRegion(ModelItemUtils.CreateModelItem(act), dbActionRegion);
            // ReSharper disable once UseObjectOrCollectionInitializer
            var regionToRestore = new DatabaseInputRegionClone();

            regionToRestore.IsEnabled = true;
            //------------Execute Test---------------------------
            region.RestoreRegion(regionToRestore);
            //------------Assert Results-------------------------
        }
コード例 #28
0
        public void WebPostActivityViewModel_ToModel_Given_IsFormDataChecked_True_ExpectFromFormDataVariableInputs()
        {
            //---------------Set up test pack-------------------
            var mockModel    = GetMockModel();
            var postActivity = GetPostActivityWithOutPuts(mockModel);

            var postViewModel = new WebPostActivityViewModel(ModelItemUtils.CreateModelItem(postActivity), mockModel);

            postViewModel.ManageServiceInputViewModel = new InputViewForWebPostTest(postViewModel, mockModel);
            postViewModel.SourceRegion.SelectedSource = postViewModel.SourceRegion.Sources.First();
            postViewModel.InputArea.Headers.Add(new NameValue("a", "asa"));
            postViewModel.InputArea.PostData                 = "this is a test body with a [[VariableNotToExpose]]";
            postViewModel.InputArea.IsManualChecked          = false;
            postViewModel.InputArea.ViewModel                = new WebPostActivityViewModelNew(ModelItemUtils.CreateModelItem(postActivity), mockModel);
            postViewModel.InputArea.IsFormDataChecked        = true;
            postViewModel.ConditionExpressionOptions.Options = new List <IOption>
            {
                new FormDataOptionConditionExpression
                {
                    Key   = "k",
                    Value = "[[VariableToExpose]]",
                    Cond  = new FormDataConditionText
                    {
                        TableType = enFormDataTableType.Text,
                        Value     = ""
                    },
                },
                new FormDataOptionConditionExpression
                {
                    Key = "k"
                },
            };
            //---------------Execute Test ----------------------
            var result = postViewModel.ToModel();

            var actualInputs = result.Inputs;

            Assert.IsTrue(actualInputs.Count == 1, "An incomplete object should not be added to list of FormDataParameters");
            Assert.IsTrue(actualInputs.First().Name == "[[VariableToExpose]]");
        }
コード例 #29
0
        public void DatabaseInputRegion_Constructor_Scenerio_Result()
        {
            var id  = Guid.NewGuid();
            var act = new DsfSqlServerDatabaseActivity()
            {
                SourceId = id
            };

            var src = new Mock <IDbServiceModel>();

            src.Setup(a => a.RetrieveSources()).Returns(new ObservableCollection <IDbSource>());
            DatabaseSourceRegion sourceRegion   = new DatabaseSourceRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfSqlServerDatabaseActivity()), enSourceType.SqlDatabase);
            DbActionRegion       dbActionRegion = new DbActionRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfSqlServerDatabaseActivity()), sourceRegion, new SynchronousAsyncWorker());

            var region = new DatabaseInputRegion(ModelItemUtils.CreateModelItem(act), dbActionRegion);

            Assert.AreEqual(region.IsEnabled, false);
            Assert.AreEqual(region.Errors.Count, 0);
        }
コード例 #30
0
 static WebServicePutViewModel CreateViewModel(DsfWebPutActivity act, MyWebModel mod)
 {
     return(new WebServicePutViewModel(ModelItemUtils.CreateModelItem(act), mod));
 }