public void WcfInputRegion_SourceChanged_UpdateValues() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var act = new DsfWcfEndPointActivity() { SourceId = id }; var src = new Mock <IWcfServiceModel>(); var lst = new ObservableCollection <IWcfServerSource>() { new WcfServiceSourceDefinition() { Name = "bravo" }, new WcfServiceSourceDefinition() { Name = "johnny" } }; src.Setup(a => a.RetrieveSources()).Returns(lst); var sourceRegion = new WcfSourceRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfWcfEndPointActivity())); var WcfActionRegion = new WcfActionRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfWcfEndPointActivity()), sourceRegion); var region = new WcfInputRegion(ModelItemUtils.CreateModelItem(act), WcfActionRegion); sourceRegion.SelectedSource = lst[0]; Assert.AreEqual(region.Inputs.Count, 0); }
public void DsfWcfEndPointActivity_Equals_InstancesWithSameParams_NotSame_Expect_False() { //-----------------------Arrange--------------------- var mockOutputDescription = new Mock <IOutputDescription>(); var wcfSource = new WcfSource(new FakeWcfProxyService()) { Name = "WcfSource", EndpointUrl = "TestUrl" }; var wcfAction = new WcfAction() { FullName = "MethodName", Method = "MethodName", }; var dsfWcfEndPointActivity = new DsfWcfEndPointActivity() { Method = wcfAction, OutputDescription = mockOutputDescription.Object, Source = wcfSource, }; //-----------------------Act------------------------- var equals = dsfWcfEndPointActivity.Equals(new DsfWcfEndPointActivity() { Method = wcfAction, OutputDescription = mockOutputDescription.Object, Source = wcfSource, }); //-----------------------Assert---------------------- Assert.IsFalse(equals); }
public void DsfWcfEndPointActivity_GetHashCode_MethodOutputDescriptionSource_NotNull_Expect_IsNotNull() { //-----------------------Arrange--------------------- var mockOutputDescription = new Mock <IOutputDescription>(); var wcfSource = new WcfSource(new FakeWcfProxyService()) { Name = "WcfSource", EndpointUrl = "TestUrl" }; var wcfAction = new WcfAction() { FullName = "MethodName", Method = "MethodName", }; var dsfWcfEndPointActivity = new DsfWcfEndPointActivity() { Method = wcfAction, OutputDescription = mockOutputDescription.Object, Source = wcfSource, }; //-----------------------Act------------------------- var hashCode = dsfWcfEndPointActivity.GetHashCode(); //-----------------------Assert---------------------- Assert.IsNotNull(hashCode); }
public void DataGridActivityFindMissingStrategy_GetActivityFields_WcfEndPoint_ShouldReturnResults_IsObject() { //------------Setup for test-------------------------- var fac = new Dev2FindMissingStrategyFactory(); var strategy = fac.CreateFindMissingStrategy(enFindMissingType.DataGridActivity); var activity = new DsfWcfEndPointActivity { Inputs = new List <IServiceInput> { new ServiceInput("Input1", "[[InputValue1]]"), new ServiceInput("Input2", "[[InputValue2]]"), new ServiceInput("Input3", "[[InputValue3]]") }, Outputs = new List <IServiceOutputMapping> { new ServiceOutputMapping("Output1", "OutputValue1", "rec"), new ServiceOutputMapping("Output2", "OutputValue2", "rec") }, OnErrorVariable = "[[err]]", OnErrorWorkflow = "[[errSvc]]", IsObject = true, ObjectName = "TheObject" }; //------------Execute Test--------------------------- var fields = strategy.GetActivityFields(activity); //------------Assert Results------------------------- Assert.AreEqual(6, fields.Count); Assert.IsTrue(fields.Contains("TheObject")); }
public void WcfInputRegion_TestClone() { var id = Guid.NewGuid(); var act = new DsfWcfEndPointActivity() { SourceId = id }; var src = new Mock <IWcfServiceModel>(); src.Setup(a => a.RetrieveSources()).Returns(new ObservableCollection <IWcfServerSource>()); WcfSourceRegion sourceRegion = new WcfSourceRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfWcfEndPointActivity())); WcfActionRegion WcfActionRegion = new WcfActionRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfWcfEndPointActivity()), sourceRegion); var region = new WcfInputRegion(ModelItemUtils.CreateModelItem(act), WcfActionRegion); Assert.AreEqual(region.IsEnabled, false); Assert.AreEqual(region.Errors.Count, 0); var clone = region.CloneRegion() as WcfInputRegion; if (clone != null) { Assert.AreEqual(clone.IsEnabled, false); Assert.AreEqual(clone.Errors.Count, 0); } }
public void DsfWcfEndPointActivity_GetFindMissingType_WhenCalled_Expect_DataGridActivity() { //-----------------------Arrange--------------------- var dsfWcfEndPointActivity = new DsfWcfEndPointActivity(); //-----------------------Act------------------------- var FindMissingType = dsfWcfEndPointActivity.GetFindMissingType(); //-----------------------Assert----------------------; Assert.AreEqual(enFindMissingType.DataGridActivity, FindMissingType); }
public void DsfWcfEndPointActivity_Equals_InstancesWithNoParams_NotSame_Expect_False() { //-----------------------Arrange--------------------- var dsfWcfEndPointActivity = new DsfWcfEndPointActivity(); //-----------------------Act------------------------- var equals = dsfWcfEndPointActivity.Equals(new DsfWcfEndPointActivity()); //-----------------------Assert---------------------- Assert.IsFalse(equals); }
public void DsfWcfEndPointActivity_Equals_IsNull_Expect_False() { //-----------------------Arrange--------------------- var dsfWcfEndPointActivity = new DsfWcfEndPointActivity(); //-----------------------Act------------------------- var equals = dsfWcfEndPointActivity.Equals(null); //-----------------------Assert---------------------- Assert.IsFalse(equals); }
public void DsfWcfEndPointActivity_Equals_IsNotNull_Expect_True() { //-----------------------Arrange--------------------- var dsfWcfEndPointActivity = new DsfWcfEndPointActivity(); //-----------------------Act------------------------- var equals = dsfWcfEndPointActivity.Equals(dsfWcfEndPointActivity); //-----------------------Assert---------------------- Assert.IsTrue(equals); }
public void DsfWcfEndPointActivity_GetHashCode_IsNotNull_Expect_True() { //-----------------------Arrange--------------------- var dsfWcfEndPointActivity = new DsfWcfEndPointActivity(); //-----------------------Act------------------------- var hashCode = dsfWcfEndPointActivity.GetHashCode(); //-----------------------Assert---------------------- Assert.IsNotNull(hashCode); }
public void DsfWcfEndPointActivity_ObjectEquals_IsNull_Expect_False() { //-----------------------Arrange--------------------- var dsfWcfEndPointActivity = new DsfWcfEndPointActivity(); var obj = new object(); obj = null; //-----------------------Act------------------------- var equals = dsfWcfEndPointActivity.Equals(obj); //-----------------------Assert---------------------- Assert.IsFalse(equals); }
public void UpdateOnActionSelection_GivenHasInputs_ShouldWriteToActiveDatalistAndPopulatesInputValues() { //---------------Set up test pack------------------- var eventAggregator = new Mock <IEventAggregator>(); var mockResourceModel = Dev2MockFactory.SetupResourceModelMock(); mockResourceModel.Setup(resModel => resModel.WorkflowXaml).Returns(WorkflowXAMLForTest()); var dataListViewModel = CreateDataListViewModel(mockResourceModel, eventAggregator.Object); var dataListItems = new OptomizedObservableCollection <IScalarItemModel>(); var dataListItem = new ScalarItemModel("scalar1", enDev2ColumnArgumentDirection.Input); var secondDataListItem = new ScalarItemModel("scalar2", enDev2ColumnArgumentDirection.Input); dataListItems.Add(dataListItem); dataListItems.Add(secondDataListItem); DataListSingleton.SetDataList(dataListViewModel); var id = Guid.NewGuid(); var act = new DsfWcfEndPointActivity() { SourceId = id }; var modelItem = ModelItemUtils.CreateModelItem(act); var actionRegion = new Mock <IActionToolRegion <IWcfAction> >(); actionRegion.Setup(region => region.SelectedAction).Returns(ValueFunction); //---------------Assert Precondition---------------- var countBefore = DataListSingleton.ActiveDataList.ScalarCollectionCount; Assert.AreEqual(4, countBefore); //---------------Execute Test ---------------------- var inputRegion = new WcfInputRegion(modelItem, actionRegion.Object); var methodInfo = typeof(WcfInputRegion).GetMethod("UpdateOnActionSelection", BindingFlags.NonPublic | BindingFlags.Instance); Assert.IsNotNull(methodInfo); methodInfo.Invoke(inputRegion, new object[] { }); //---------------Test Result ----------------------- Assert.AreEqual("[[name]]", inputRegion.Inputs.ToList()[0].Value); Assert.AreEqual("[[surname]]", inputRegion.Inputs.ToList()[1].Value); }
public void WcfInputRegion_Test_InputAddHeader_ExpectHeightChangesPastThree() { var id = Guid.NewGuid(); var act = new DsfWcfEndPointActivity() { SourceId = id }; var src = new Mock <IWcfServiceModel>(); src.Setup(a => a.RetrieveSources()).Returns(new ObservableCollection <IWcfServerSource>()); var sourceRegion = new WcfSourceRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfWcfEndPointActivity())); var WcfActionRegion = new WcfActionRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfWcfEndPointActivity()), sourceRegion); var region = new WcfInputRegion(ModelItemUtils.CreateModelItem(act), WcfActionRegion); Assert.AreEqual(region.IsEnabled, false); }
public void GivenIOpenNewWcfTool() { var activity = new DsfWcfEndPointActivity(); var modelItem = ModelItemUtils.CreateModelItem(activity); var mockServiceInputViewModel = new Mock <IManageWcfSourceViewModel>(); var mockDbServiceModel = new Mock <IWcfServiceModel>(); 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); var src = new WcfServiceSourceDefinition() { Name = "Echo", Id = Guid.NewGuid(), Path = "k:\\bob.dll", EndpointUrl = "Https:/localhost" }; var srcs = new ObservableCollection <IWcfServerSource> { src }; mockDbServiceModel.Setup(model => model.RetrieveSources()).Returns(srcs); mockDbServiceModel.Setup(a => a.GetActions(src)).Returns(new List <IWcfAction> { new WcfAction() { FullName = "Echome" } }); mockServiceInputViewModel.SetupAllProperties(); var resource = new Mock <IContextualResourceModel>(); resource.Setup(a => a.GetErrors(It.IsAny <Guid>())).Returns(new ObservableReadOnlyList <IErrorInfo>()); var sqlServerDesignerViewModel = new WcfEndPointViewModel(modelItem, mockDbServiceModel.Object); scenarioContext.Add("viewModel", sqlServerDesignerViewModel); scenarioContext.Add("mockServiceInputViewModel", mockServiceInputViewModel); scenarioContext.Add("mockDbServiceModel", mockDbServiceModel); }
public void WcfInputRegion_Constructor_Scenerio_Result() { var id = Guid.NewGuid(); var act = new DsfWcfEndPointActivity() { SourceId = id }; var src = new Mock <IWcfServiceModel>(); src.Setup(a => a.RetrieveSources()).Returns(new ObservableCollection <IWcfServerSource>()); var sourceRegion = new WcfSourceRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfWcfEndPointActivity())); var WcfActionRegion = new WcfActionRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfWcfEndPointActivity()), sourceRegion); var region = new WcfInputRegion(ModelItemUtils.CreateModelItem(act), WcfActionRegion); Assert.AreEqual(region.IsEnabled, false); Assert.AreEqual(region.Errors.Count, 0); }
public void WcfInputRegion_RestoreFromPrevious_Restore_ExpectValuesChanged() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var act = new DsfWcfEndPointActivity() { SourceId = id }; var src = new Mock <IWcfServiceModel>(); src.Setup(a => a.RetrieveSources()).Returns(new ObservableCollection <IWcfServerSource>()); var sourceRegion = new WcfSourceRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfWcfEndPointActivity())); var WcfActionRegion = new WcfActionRegion(src.Object, ModelItemUtils.CreateModelItem(new DsfWcfEndPointActivity()), sourceRegion); var region = new WcfInputRegion(ModelItemUtils.CreateModelItem(act), WcfActionRegion); var regionToRestore = new WcfInputRegionClone(); regionToRestore.IsEnabled = true; //------------Execute Test--------------------------- region.RestoreRegion(regionToRestore as IToolRegion); //------------Assert Results------------------------- }
private ModelItem CreateModelItem() { var wcfActivity = new DsfWcfEndPointActivity(); return(ModelItemUtils.CreateModelItem(wcfActivity)); }