public void DataGridActivityFindMissingStrategy_GetActivityFields_ODBC_ShouldReturnResults() { //------------Setup for test-------------------------- Dev2FindMissingStrategyFactory fac = new Dev2FindMissingStrategyFactory(); IFindMissingStrategy strategy = fac.CreateFindMissingStrategy(enFindMissingType.DataGridActivity); var activity = new DsfODBCDatabaseActivity { CommandText = "[[InputValue1]] [[InputValue2]][[InputValue3]]", Outputs = new List <IServiceOutputMapping> { new ServiceOutputMapping("Output1", "OutputValue1", "rec"), new ServiceOutputMapping("Output2", "OutputValue2", "rec") }, OnErrorVariable = "[[err]]", OnErrorWorkflow = "[[errSvc]]" }; //------------Execute Test--------------------------- var fields = strategy.GetActivityFields(activity); //------------Assert Results------------------------- Assert.AreEqual(5, fields.Count); Assert.IsTrue(fields.Contains("[[InputValue1]] [[InputValue2]][[InputValue3]]")); Assert.IsTrue(fields.Contains("[[rec().OutputValue1]]")); Assert.IsTrue(fields.Contains("[[rec().OutputValue2]]")); Assert.IsTrue(fields.Contains("[[err]]")); Assert.IsTrue(fields.Contains("[[errSvc]]")); }
public void ODBCServer_GenerateOutputsVisible() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var mod = new ODBCServerModel(); var act = new DsfODBCDatabaseActivity { SourceId = mod.Sources[0].Id, Inputs = new List <IServiceInput>() { new ServiceInput("[[a]]", "asa") }, Outputs = new List <IServiceOutputMapping> { new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("d", "e", "f") }, ServiceName = "dsfBob" }; //------------Execute Test--------------------------- var ODBCServer = new ODBCDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod); ODBCServer.GenerateOutputsVisible = true; //------------Assert Results------------------------- Assert.IsFalse(ODBCServer.OutputsRegion.IsEnabled); }
public void Equals_Given_SameInputsDifferentIndexes_ActivityTools_AreNotEqual() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var inputs = new List <Common.Interfaces.DB.IServiceInput> { new ServiceInput("Input2", "[[InputValue2]]"), new ServiceInput("Input1", "[[InputValue1]]") }; var inputs2 = new List <Common.Interfaces.DB.IServiceInput> { new ServiceInput("Input1", "[[InputValue1]]"), new ServiceInput("Input2", "[[InputValue2]]") }; var activity = new DsfODBCDatabaseActivity() { UniqueID = uniqueId, Inputs = inputs }; var activity1 = new DsfODBCDatabaseActivity() { UniqueID = uniqueId, Inputs = inputs2 }; //---------------Assert Precondition---------------- Assert.IsNotNull(activity); //---------------Execute Test ---------------------- var @equals = activity.Equals(activity1); //---------------Test Result ----------------------- Assert.IsFalse(@equals); }
public void ODBCServer_WorstError() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var mod = new ODBCServerModel(); var act = new DsfODBCDatabaseActivity { SourceId = mod.Sources[0].Id, Inputs = new List <IServiceInput>() { new ServiceInput("[[a]]", "asa") }, Outputs = new List <IServiceOutputMapping> { new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("d", "e", "f") }, ServiceName = "dsfBob" }; //------------Execute Test--------------------------- var ODBCServer = new ODBCDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod); var err = ODBCServer.IsWorstErrorReadOnly; var errType = ODBCServer.WorstError; //------------Assert Results------------------------- Assert.IsNotNull(errType); Assert.IsTrue(err); }
public void ODBCServer_MethodName_Scenerio_Result_oneParementer() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var mod = new ODBCServerModel(); var act = new DsfODBCDatabaseActivity { SourceId = mod.Sources[0].Id, Inputs = new List <IServiceInput>() { new ServiceInput("[[a]]", "asa") }, Outputs = new List <IServiceOutputMapping> { new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("d", "e", "f") }, ServiceName = "dsfBob" }; //------------Execute Test--------------------------- var ODBCServer = new ODBCDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act)); //------------Assert Results------------------------- Assert.IsTrue(ODBCServer.SourceRegion.IsEnabled); Assert.IsTrue(ODBCServer.ActionRegion.IsEnabled); Assert.IsTrue(ODBCServer.ErrorRegion.IsEnabled); ODBCServer.ValidateTestComplete(); Assert.IsTrue(ODBCServer.OutputsRegion.IsEnabled); }
public static DsfODBCDatabaseActivity GetDsfODBCDatabaseActivity(DsfDatabaseActivity dbActivity, DbService service, DbSource source) { var dsfOdbcDatabaseActivity = new DsfODBCDatabaseActivity { ResourceID = dbActivity.ResourceID, SourceId = source.ResourceID, CommandText = service.Method.ExecuteAction, Inputs = TranslateInputMappingToInputs(dbActivity.InputMapping), Outputs = TranslateOutputMappingToOutputs(dbActivity.OutputMapping), ToolboxFriendlyName = dbActivity.ToolboxFriendlyName, IconPath = dbActivity.IconPath, ServiceName = dbActivity.ServiceName, DataTags = dbActivity.DataTags, ResultValidationRequiredTags = dbActivity.ResultValidationRequiredTags, ResultValidationExpression = dbActivity.ResultValidationExpression, FriendlySourceName = dbActivity.FriendlySourceName, EnvironmentID = dbActivity.EnvironmentID, Type = dbActivity.Type, ActionName = dbActivity.ActionName, RunWorkflowAsync = dbActivity.RunWorkflowAsync, Category = dbActivity.Category, ServiceUri = dbActivity.ServiceUri, ServiceServer = dbActivity.ServiceServer, UniqueID = dbActivity.UniqueID, ParentServiceName = dbActivity.ParentServiceName, ParentServiceID = dbActivity.ParentServiceID, ParentWorkflowInstanceId = dbActivity.ParentWorkflowInstanceId, ParentInstanceID = dbActivity.ParentInstanceID, }; return(dsfOdbcDatabaseActivity); }
public void Equals_Given_SameOutputs_DifferentIndexes_ActivityTools_AreNotEqual() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var outputs = new List <Common.Interfaces.DB.IServiceOutputMapping> { new ServiceOutputMapping("d", "e", "f"), new ServiceOutputMapping("a", "b", "c") }; var outputs2 = new List <Common.Interfaces.DB.IServiceOutputMapping> { new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("d", "e", "f") }; var activity = new DsfODBCDatabaseActivity() { UniqueID = uniqueId, Outputs = outputs }; var activity1 = new DsfODBCDatabaseActivity() { UniqueID = uniqueId, Outputs = outputs2 }; //---------------Assert Precondition---------------- Assert.IsNotNull(activity); //---------------Execute Test ---------------------- var @equals = activity.Equals(activity1); //---------------Test Result ----------------------- Assert.IsFalse(@equals); }
public void ODBCServer_LabelWidth() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var mod = new ODBCServerModel(); var act = new DsfODBCDatabaseActivity { SourceId = mod.Sources[0].Id, Inputs = new List <IServiceInput>() { new ServiceInput("[[a]]", "asa") }, Outputs = new List <IServiceOutputMapping> { new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("d", "e", "f") }, ServiceName = "dsfBob" }; //------------Execute Test--------------------------- var ODBCServer = new ODBCDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod); var width = ODBCServer.LabelWidth; //------------Assert Results------------------------- Assert.IsNotNull(width); }
public void ODBCServer_MethodName_ClearErrors() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var mod = new ODBCServerModel(); var act = new DsfODBCDatabaseActivity(); var ODBCServer = new ODBCDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod); //------------Execute Test--------------------------- ODBCServer.ClearValidationMemoWithNoFoundError(); //------------Assert Results------------------------- Assert.IsNull(ODBCServer.Errors); Assert.AreEqual(ODBCServer.DesignValidationErrors.Count, 1); }
public void ODBCServer_VerifyCommandTimeout() { //------------Setup for test-------------------------- var mod = new ODBCServerModel(); var act = new DsfODBCDatabaseActivity(); //------------Execute Test--------------------------- using (var vm = new ODBCDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod)) { vm.InputArea.CommandTimeout = 321; //------------Assert Results------------------------- var dbService = vm.ToModel(); Assert.AreEqual(321, dbService.CommandTimeout); } }
public void UniqueIDDifferent_EmptyOdbcDatabase_Object_Is_Not_Equal() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var activity1 = new DsfODBCDatabaseActivity(); var odbcDatabase = new DsfODBCDatabaseActivity(); //---------------Assert Precondition---------------- Assert.IsNotNull(activity1); //---------------Execute Test ---------------------- var @equals = activity1.Equals(odbcDatabase); //---------------Test Result ----------------------- Assert.IsFalse(@equals); }
public void ODBCServer_Ctor_EmptyModelItem() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var mod = new ODBCServerModel(); var act = new DsfODBCDatabaseActivity(); //------------Execute Test--------------------------- var ODBCServer = new ODBCDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod); //------------Assert Results------------------------- Assert.IsTrue(ODBCServer.SourceRegion.IsEnabled); Assert.IsFalse(ODBCServer.OutputsRegion.IsEnabled); Assert.IsFalse(ODBCServer.InputArea.IsEnabled); Assert.IsTrue(ODBCServer.ErrorRegion.IsEnabled); }
public void ODBCServer_TestActionSetSourceAndTestClickOkHasMappings() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var mod = new ODBCServerModel(); var act = new DsfODBCDatabaseActivity(); //------------Execute Test--------------------------- var ODBCServer = new ODBCDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod); ODBCServer.SourceRegion.SelectedSource = ODBCServer.SourceRegion.Sources.First(); #pragma warning restore 4014 //------------Assert Results------------------------- Assert.IsTrue(ODBCServer.SourceRegion.IsEnabled); Assert.IsTrue(ODBCServer.ErrorRegion.IsEnabled); Assert.AreEqual(0, ODBCServer.ManageServiceInputViewModel.Errors.Count); }
public void ODBCServer_TestActionSetSource() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var mod = new ODBCServerModel(); var act = new DsfODBCDatabaseActivity(); //------------Execute Test--------------------------- var ODBCServer = new ODBCDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod); ODBCServer.ManageServiceInputViewModel = new InputViewForTest(ODBCServer, mod); ODBCServer.SourceRegion.SelectedSource = ODBCServer.SourceRegion.Sources.First(); //------------Assert Results------------------------- Assert.IsTrue(ODBCServer.SourceRegion.IsEnabled); Assert.IsFalse(ODBCServer.OutputsRegion.IsEnabled); Assert.IsTrue(ODBCServer.ErrorRegion.IsEnabled); }
public void UniqueIDEquals_EmptyOdbcDatabase_Object_Is_Equal() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var odbcDatabase = new DsfODBCDatabaseActivity() { UniqueID = uniqueId }; var activity = new DsfODBCDatabaseActivity() { UniqueID = uniqueId }; //---------------Assert Precondition---------------- Assert.IsNotNull(odbcDatabase); //---------------Execute Test ---------------------- var equals = odbcDatabase.Equals(activity); //---------------Test Result ----------------------- Assert.IsTrue(@equals); }
public void Equals_Given_Same_DisplayName_IsEqual() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var activity1 = new DsfODBCDatabaseActivity() { UniqueID = uniqueId, DisplayName = "a" }; var odbcDatabase = new DsfODBCDatabaseActivity() { UniqueID = uniqueId, DisplayName = "a" }; //---------------Assert Precondition---------------- Assert.IsNotNull(activity1); //---------------Execute Test ---------------------- var @equals = activity1.Equals(odbcDatabase); //---------------Test Result ----------------------- Assert.IsTrue(@equals); }
public void Equals_Given_Different_CommandText_Is_Not_Equal() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var activity1 = new DsfODBCDatabaseActivity() { UniqueID = uniqueId, CommandText = "A" }; var odbcDatabase = new DsfODBCDatabaseActivity() { UniqueID = uniqueId, CommandText = "ass" }; //---------------Assert Precondition---------------- Assert.IsNotNull(activity1); //---------------Execute Test ---------------------- var @equals = activity1.Equals(odbcDatabase); //---------------Test Result ----------------------- Assert.IsFalse(@equals); }
public void Equals_Given_Same_SourceId_IsEqual() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var sourceId = Guid.NewGuid();; var activity1 = new DsfODBCDatabaseActivity() { UniqueID = uniqueId, SourceId = sourceId }; var activity = new DsfODBCDatabaseActivity() { UniqueID = uniqueId, SourceId = sourceId }; //---------------Assert Precondition---------------- Assert.IsNotNull(activity1); //---------------Execute Test ---------------------- var @equals = activity1.Equals(activity); //---------------Test Result ----------------------- Assert.IsTrue(@equals); }
public void Equals_Given_SameOutputs_ActivityTools_AreEqual() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var outputs = new List <Common.Interfaces.DB.IServiceOutputMapping>(); var activity = new DsfODBCDatabaseActivity() { UniqueID = uniqueId, Outputs = outputs }; var activity1 = new DsfODBCDatabaseActivity() { UniqueID = uniqueId, Outputs = outputs }; //---------------Assert Precondition---------------- Assert.IsNotNull(activity); //---------------Execute Test ---------------------- var @equals = activity.Equals(activity1); //---------------Test Result ----------------------- Assert.IsTrue(@equals); }
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); }