public void WebDeleteInputRegion_RestoreFromPrevios_Restore_ExpectValuesChanged() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var act = new DsfWebDeleteActivity() { SourceId = id }; var src = new Mock <IWebServiceSource>(); var mod = new Mock <IWebServiceModel>(); mod.Setup(a => a.RetrieveSources()).Returns(new List <IWebServiceSource>()); var srcreg = new WebSourceRegion(mod.Object, ModelItemUtils.CreateModelItem(new DsfWebDeleteActivity())); var region = new WebDeleteInputRegion(ModelItemUtils.CreateModelItem(act), srcreg); var regionToRestore = new WebDeleteInputRegion(ModelItemUtils.CreateModelItem(act), srcreg); regionToRestore.IsEnabled = true; regionToRestore.QueryString = "blob"; regionToRestore.Headers = new ObservableCollection <INameValue> { new NameValue("a", "b") }; //------------Execute Test--------------------------- region.RestoreRegion(regionToRestore as IToolRegion); //------------Assert Results------------------------- Assert.AreEqual(region.QueryString, "blob"); Assert.AreEqual(region.Headers.First().Name, "a"); Assert.AreEqual(region.Headers.First().Value, "b"); }
public void TestClone() { var id = Guid.NewGuid(); var act = new DsfWebDeleteActivity() { SourceId = id }; var src = new Mock <IWebServiceSource>(); var mod = new Mock <IWebServiceModel>(); mod.Setup(a => a.RetrieveSources()).Returns(new List <IWebServiceSource>()); WebSourceRegion srcreg = new WebSourceRegion(mod.Object, ModelItemUtils.CreateModelItem(new DsfWebDeleteActivity())); var region = new WebDeleteInputRegion(ModelItemUtils.CreateModelItem(act), srcreg); Assert.AreEqual(region.IsEnabled, false); Assert.AreEqual(region.Errors.Count, 0); var clone = region.CloneRegion() as WebDeleteInputRegion; if (clone != null) { Assert.AreEqual(clone.IsEnabled, false); Assert.AreEqual(clone.Errors.Count, 0); } }
public void WebInputRegion_SrcChanged_UpdateValues() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var act = new DsfWebDeleteActivity() { SourceId = id }; var src = new Mock <IWebServiceSource>(); var mod = new Mock <IWebServiceModel>(); var lst = new List <IWebServiceSource> { new WebServiceSourceDefinition() { HostName = "bob", DefaultQuery = "Dave" }, new WebServiceSourceDefinition() { HostName = "f", DefaultQuery = "g" } }; mod.Setup(a => a.RetrieveSources()).Returns(lst); var srcreg = new WebSourceRegion(mod.Object, ModelItemUtils.CreateModelItem(new DsfWebDeleteActivity())); var region = new WebDeleteInputRegion(ModelItemUtils.CreateModelItem(act), srcreg); var regionToRestore = new WebDeleteInputRegion(ModelItemUtils.CreateModelItem(act), srcreg); srcreg.SelectedSource = lst[0]; Assert.AreEqual(region.QueryString, "Dave"); Assert.AreEqual(region.RequestUrl, "bob"); }
public void Equals_Given_Different_OutputDescription_IsNOTEqual() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var outDescr = new OutputDescription() { Format = OutputFormats.Unknown }; var outDescr2 = new OutputDescription() { Format = OutputFormats.ShapedXML }; var webDelete = new DsfWebDeleteActivity() { UniqueID = uniqueId, OutputDescription = outDescr }; var webDelete1 = new DsfWebDeleteActivity() { UniqueID = uniqueId, OutputDescription = outDescr2 }; //---------------Assert Precondition---------------- Assert.IsNotNull(webDelete); //---------------Execute Test ---------------------- var @equals = webDelete.Equals(webDelete1); //---------------Test Result ----------------------- Assert.IsFalse(@equals); }
public void DataGridActivityFindMissingStrategy_GetActivityFields_WebDeleteActivity_ShouldReturnResults_IsObject() { //------------Setup for test-------------------------- var fac = new Dev2FindMissingStrategyFactory(); var strategy = fac.CreateFindMissingStrategy(enFindMissingType.DataGridActivity); var activity = new DsfWebDeleteActivity { 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") }, QueryString = "[[qstring]]", Headers = new List <INameValue> { new NameValue("Content-Type", "[[ctype]]") }, OnErrorVariable = "[[err]]", OnErrorWorkflow = "[[errSvc]]", IsObject = true, ObjectName = "TheObject" }; //------------Execute Test--------------------------- var fields = strategy.GetActivityFields(activity); //------------Assert Results------------------------- Assert.IsTrue(fields.Contains("TheObject")); }
public void Equals_Given_Same_Headers_DifferentIndexes_IsNotEqual() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var headers = new List <INameValue> { new NameValue("b", "y"), new NameValue("a", "x") }; var headers2 = new List <INameValue> { new NameValue("a", "x"), new NameValue("b", "y") }; var webDelete = new DsfWebDeleteActivity() { UniqueID = uniqueId, Headers = headers }; var webDelete1 = new DsfWebDeleteActivity() { UniqueID = uniqueId, Headers = headers }; //---------------Assert Precondition---------------- Assert.IsNotNull(webDelete); //---------------Execute Test ---------------------- var @equals = webDelete.Equals(webDelete1); //---------------Test Result ----------------------- Assert.IsTrue(@equals); }
public void WebDeleteInputRegion_Headers_AddEmptyHeaders() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var webDeleteActivity = new DsfWebDeleteActivity { SourceId = id, Headers = new ObservableCollection <INameValue> { new NameValue("a", "b") }, }; var mod = new Mock <IWebServiceModel>(); mod.Setup(a => a.RetrieveSources()).Returns(new List <IWebServiceSource>()); var modelItem = ModelItemUtils.CreateModelItem(webDeleteActivity); var webSourceRegion = new WebSourceRegion(mod.Object, modelItem); var region = new WebDeleteInputRegion(modelItem, webSourceRegion); //------------Execute Test--------------------------- //------------Assert Results------------------------- Assert.AreEqual(2, region.Headers.Count); Assert.AreEqual("a", region.Headers[0].Name); Assert.AreEqual("b", region.Headers[0].Value); Assert.AreEqual("", region.Headers[1].Name); Assert.AreEqual("", region.Headers[1].Value); }
public void Equals_Given_SameWebDeleteTool_IsEqual() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var webputActivity = new DsfWebDeleteActivity(); var webputActivity1 = webputActivity; //---------------Assert Precondition---------------- Assert.IsNotNull(webputActivity); //---------------Execute Test ---------------------- var @equals = webputActivity.Equals(webputActivity1); //---------------Test Result ----------------------- Assert.IsTrue(@equals); }
public void WebDeleteInputRegion_TestInputCtor() { var id = Guid.NewGuid(); var act = new DsfWebDeleteActivity { SourceId = id }; var mod = new Mock <IWebServiceModel>(); mod.Setup(a => a.RetrieveSources()).Returns(new List <IWebServiceSource>()); var webSourceRegion = new WebSourceRegion(mod.Object, ModelItemUtils.CreateModelItem(new DsfWebDeleteActivity())); var region = new WebDeleteInputRegion(ModelItemUtils.CreateModelItem(act), webSourceRegion); Assert.AreEqual(region.IsEnabled, false); Assert.AreEqual(region.Errors.Count, 0); }
public void GivenIDragWebDeleteRequestConnectorToolOntoTheDesignSurface() { var activity = new DsfWebDeleteActivity(); 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); _webHelooWebSource = new WebServiceSourceDefinition { Name = "WebHeloo" }; _dev2CountriesWebServiceWebSource = new WebServiceSourceDefinition { Name = "Dev2CountriesWebService", HostName = "http://rsaklfsvrtfsbld/integrationTestSite/GetCountries.ashx" }; _googleWebSource = new WebServiceSourceDefinition { Name = "Google Address Lookup" }; var sources = new ObservableCollection <IWebServiceSource> { _dev2CountriesWebServiceWebSource }; mockServiceModel.Setup(model => model.RetrieveSources()).Returns(sources); mockServiceModel.Setup(model => model.EditSource(It.IsAny <IWebServiceSource>())).Verifiable(); mockServiceInputViewModel.SetupAllProperties(); var viewModel = new WebServiceDeleteViewModel(modelItem, mockServiceModel.Object); scenarioContext.Add("viewModel", viewModel); scenarioContext.Add("mockServiceInputViewModel", mockServiceInputViewModel); scenarioContext.Add("mockServiceModel", mockServiceModel); }
public void DsfWebDeleteActivity_Execute_ErrorResponse_ShouldSetVariables() { //------------Setup for test-------------------------- const string response = "{\"Message\":\"Error\"}"; var dsfWebDeleteActivity = new DsfWebDeleteActivity(); dsfWebDeleteActivity.ResourceID = InArgument <Guid> .FromValue(Guid.Empty); var mockResourceCatalog = new Mock <IResourceCatalog>(); var webSource = new WebSource(); var dependency = new Depends(Depends.ContainerType.WebApi); webSource.Address = $"http://{dependency.Container.IP}:{dependency.Container.Port}/api/"; webSource.AuthenticationType = AuthenticationType.Anonymous; mockResourceCatalog.Setup(resCat => resCat.GetResource <WebSource>(It.IsAny <Guid>(), It.IsAny <Guid>())).Returns(webSource); dsfWebDeleteActivity.ResourceCatalog = mockResourceCatalog.Object; var serviceOutputs = new List <IServiceOutputMapping> { new ServiceOutputMapping("Message", "[[Message]]", "") }; dsfWebDeleteActivity.Outputs = serviceOutputs; var serviceXml = XmlResource.Fetch("WebService"); var service = new WebService(serviceXml) { RequestResponse = response }; dsfWebDeleteActivity.OutputDescription = service.GetOutputDescription(); dsfWebDeleteActivity.QueryString = "Error"; dsfWebDeleteActivity.SourceId = Guid.Empty; dsfWebDeleteActivity.Headers = new List <INameValue>(); var dataObject = new DsfDataObject("", Guid.NewGuid()); dataObject.EsbChannel = new MockEsb(); //------------Execute Test--------------------------- dsfWebDeleteActivity.Execute(dataObject, 0); //------------Assert Results------------------------- Assert.AreEqual("Error", ExecutionEnvironment.WarewolfEvalResultToString(dataObject.Environment.Eval("[[Message]]", 0))); }
public void Equals_Given_Same_DisplayName_Value_IsEqual() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var webDelete = new DsfWebDeleteActivity() { UniqueID = uniqueId, DisplayName = "" }; var webDelete1 = new DsfWebDeleteActivity() { UniqueID = uniqueId, DisplayName = "" }; //---------------Assert Precondition---------------- Assert.IsNotNull(webDelete); //---------------Execute Test ---------------------- var @equals = webDelete.Equals(webDelete1); //---------------Test Result ----------------------- Assert.IsTrue(@equals); }
public void Equals_Given_Different_QueryString_IsNOTEqual() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var webDelete = new DsfWebDeleteActivity() { UniqueID = uniqueId, QueryString = "A" }; var webDelete1 = new DsfWebDeleteActivity() { UniqueID = uniqueId, QueryString = "B" }; //---------------Assert Precondition---------------- Assert.IsNotNull(webDelete); //---------------Execute Test ---------------------- var @equals = webDelete.Equals(webDelete1); //---------------Test Result ----------------------- Assert.IsFalse(@equals); }
public void Equals_Given_DifferentWebDeleteToolIds_AreNotEqual() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var uniqueId2 = Guid.NewGuid().ToString(); var webputActivity = new DsfWebDeleteActivity() { UniqueID = uniqueId }; var webputActivity1 = new DsfWebDeleteActivity() { UniqueID = uniqueId2 }; //---------------Assert Precondition---------------- Assert.IsNotNull(webputActivity); //---------------Execute Test ---------------------- var @equals = webputActivity.Equals(webputActivity1); //---------------Test Result ----------------------- Assert.IsFalse(@equals); }
public void Equals_Given_Same_OutputDescription_IsEqual() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var outDescr = new OutputDescription(); var webDelete = new DsfWebDeleteActivity() { UniqueID = uniqueId, OutputDescription = outDescr }; var webDelete1 = new DsfWebDeleteActivity() { UniqueID = uniqueId, OutputDescription = outDescr }; //---------------Assert Precondition---------------- Assert.IsNotNull(webDelete); //---------------Execute Test ---------------------- var @equals = webDelete.Equals(webDelete1); //---------------Test Result ----------------------- Assert.IsTrue(@equals); }