public void WebPutActivity_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 webPut = new WebPutActivity()
            {
                UniqueID = uniqueId, OutputDescription = outDescr
            };
            var webPut1 = new WebPutActivity()
            {
                UniqueID = uniqueId, OutputDescription = outDescr2
            };

            //---------------Assert Precondition----------------
            Assert.IsNotNull(webPut);
            //---------------Execute Test ----------------------
            var @equals = webPut.Equals(webPut1);

            //---------------Test Result -----------------------
            Assert.IsFalse(@equals);
        }
        public void WebPutActivity_Equals_Given_Different_Headers_IsNOTEqual()
        {
            //---------------Set up test pack-------------------
            var uniqueId = Guid.NewGuid().ToString();
            var headers  = new List <INameValue>();
            var headers2 = new List <INameValue> {
                new NameValue("a", "x")
            };
            var webPut = new WebPutActivity()
            {
                UniqueID = uniqueId, Headers = headers
            };
            var webPut1 = new WebPutActivity()
            {
                UniqueID = uniqueId, Headers = headers2
            };

            //---------------Assert Precondition----------------
            Assert.IsNotNull(webPut);
            //---------------Execute Test ----------------------
            var @equals = webPut.Equals(webPut1);

            //---------------Test Result -----------------------
            Assert.IsFalse(@equals);
        }
Ejemplo n.º 3
0
        public void WebPutInputRegion_Headers_AddEmptyHeaders()
        {
            //------------Setup for test--------------------------
            var id             = Guid.NewGuid();
            var webPutActivity = new WebPutActivity
            {
                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(webPutActivity);

            var webSourceRegion = new WebSourceRegion(mod.Object, modelItem);
            var region          = new WebPutInputRegion(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 DataGridActivityFindMissingStrategy_GetActivityFields_WebPutActivity_ShouldReturnResults_IsObject()
        {
            //------------Setup for test--------------------------
            var fac      = new Dev2FindMissingStrategyFactory();
            var strategy = fac.CreateFindMissingStrategy(enFindMissingType.DataGridActivity);
            var activity = new WebPutActivity
            {
                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]]",
                PutData         = "[[putdata]]",
                IsObject        = true,
                ObjectName      = "TheObject"
            };
            //------------Execute Test---------------------------
            var fields = strategy.GetActivityFields(activity);

            //------------Assert Results-------------------------
            Assert.IsTrue(fields.Contains("TheObject"));
        }
Ejemplo n.º 5
0
        public void WebPutInputRegion_SrcChanged_UpdateValues()
        {
            //------------Setup for test--------------------------
            var id  = Guid.NewGuid();
            var act = new WebPutActivity {
                SourceId = id
            };

            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 webSourceRegion = new WebSourceRegion(mod.Object, ModelItemUtils.CreateModelItem(new WebPutActivity()));
            var region          = new WebPutInputRegion(ModelItemUtils.CreateModelItem(act), webSourceRegion);

            webSourceRegion.SelectedSource = lst[0];
            Assert.AreEqual(region.QueryString, "Dave");
            Assert.AreEqual(region.RequestUrl, "bob");
        }
Ejemplo n.º 6
0
        public void WebPutInputRegion_TestClone_IsPutDataBase64()
        {
            var id  = Guid.NewGuid();
            var act = new WebPutActivity
            {
                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 WebPutActivity()));
            var region          = new WebPutInputRegion(ModelItemUtils.CreateModelItem(act), webSourceRegion)
            {
                PutData = "bob", IsPutDataBase64 = true
            };

            Assert.AreEqual(region.IsEnabled, false);
            Assert.AreEqual(region.Errors.Count, 0);
            if (region.CloneRegion() is WebPutInputRegion clone)
            {
                Assert.AreEqual(clone.IsEnabled, false);
                Assert.AreEqual(clone.Errors.Count, 0);
                Assert.AreEqual(clone.PutData, "bob");
                Assert.IsTrue(clone.IsPutDataBase64);
            }
        }
Ejemplo n.º 7
0
        public void WebPutActivity_Constructor_Correctly_ShouldSetTypeDisplayName()
        {
            //------------Setup for test--------------------------
            //------------Execute Test---------------------------
            var DsfWebPutActivity = new WebPutActivity();

            //------------Assert Results-------------------------
            Assert.AreEqual("PUT Web Method", DsfWebPutActivity.DisplayName);
        }
Ejemplo n.º 8
0
        public void WebPutActivity_Constructed_Correctly_ShouldHaveInheritDsfActivity()
        {
            //------------Setup for test--------------------------
            //------------Execute Test---------------------------
            var DsfWebPutActivity = new WebPutActivity();

            //------------Assert Results-------------------------
            Assert.IsInstanceOfType(DsfWebPutActivity, typeof(DsfActivity));
        }
        public void WebPutActivity_Equals_Given_SameWebPutTool_IsEqual()
        {
            //---------------Set up test pack-------------------
            var webputActivity  = new WebPutActivity();
            var webputActivity1 = webputActivity;

            //---------------Assert Precondition----------------
            Assert.IsNotNull(webputActivity);
            //---------------Execute Test ----------------------
            var @equals = webputActivity.Equals(webputActivity1);

            //---------------Test Result -----------------------
            Assert.IsTrue(@equals);
        }
Ejemplo n.º 10
0
        public void WebPutInputRegion_TestInputCtor()
        {
            var id  = Guid.NewGuid();
            var act = new WebPutActivity {
                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 WebPutActivity()));
            var region          = new WebPutInputRegion(ModelItemUtils.CreateModelItem(act), webSourceRegion);

            Assert.AreEqual(false, region.IsEnabled);
            Assert.AreEqual(0, region.Errors.Count);
        }
Ejemplo n.º 11
0
        public void GivenIDragWebPutRequestConnectorToolOntoTheDesignSurface()
        {
            var activity  = new WebPutActivity();
            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://TFSBLD.premier.local/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 WebPutActivityViewModel(modelItem, mockServiceModel.Object);


            scenarioContext.Add("viewModel", viewModel);
            scenarioContext.Add("mockServiceInputViewModel", mockServiceInputViewModel);
            scenarioContext.Add("mockServiceModel", mockServiceModel);
        }
Ejemplo n.º 12
0
        public void WebPutActivity_Execute_ErrorResponse_ShouldSetVariables()
        {
            //------------Setup for test--------------------------
            const string response          = "{\"Message\":\"Error\"}";
            var          dsfWebPutActivity = new WebPutActivity
            {
                ResourceID = InArgument <Guid> .FromValue(Guid.Empty)
            };
            var mockResourceCatalog = new Mock <IResourceCatalog>();
            var dependency          = new Depends(Depends.ContainerType.WebApi);
            var webSource           = new WebSource
            {
                Address            = $"http://{dependency.Container.IP}:{dependency.Container.Port}/api/",
                AuthenticationType = AuthenticationType.Anonymous
            };

            mockResourceCatalog.Setup(resCat => resCat.GetResource <WebSource>(It.IsAny <Guid>(), It.IsAny <Guid>())).Returns(webSource);
            dsfWebPutActivity.ResourceCatalog = mockResourceCatalog.Object;
            var serviceOutputs = new List <IServiceOutputMapping> {
                new ServiceOutputMapping("Message", "[[Message]]", "")
            };

            dsfWebPutActivity.Outputs = serviceOutputs;
            var serviceXml = XmlResource.Fetch("WebService");
            var service    = new WebService(serviceXml)
            {
                RequestResponse = response
            };

            dsfWebPutActivity.OutputDescription = service.GetOutputDescription();

            dsfWebPutActivity.QueryString = "Error";

            dsfWebPutActivity.SourceId = Guid.Empty;
            dsfWebPutActivity.Headers  = new List <INameValue>();
            var dataObject = new DsfDataObject("", Guid.NewGuid())
            {
                EsbChannel = new MockEsb()
            };

            //------------Execute Test---------------------------
            dsfWebPutActivity.Execute(dataObject, 0);
            //------------Assert Results-------------------------
            Assert.AreEqual("Error", ExecutionEnvironment.WarewolfEvalResultToString(dataObject.Environment.Eval("[[Message]]", 0)));
        }
        public void WebPutActivity_Equals_Given_SameUniqueID_EmptyWebPutTools_AreEqual()
        {
            //---------------Set up test pack-------------------
            var uniqueId       = Guid.NewGuid().ToString();
            var webputActivity = new WebPutActivity()
            {
                UniqueID = uniqueId
            };
            var webputActivity1 = new WebPutActivity()
            {
                UniqueID = uniqueId
            };

            //---------------Assert Precondition----------------
            Assert.IsNotNull(webputActivity);
            //---------------Execute Test ----------------------
            var @equals = webputActivity.Equals(webputActivity1);

            //---------------Test Result -----------------------
            Assert.IsTrue(@equals);
        }
        public void WebPutActivity_Equals_Given_Same_PutData_Value_IsEqual()
        {
            //---------------Set up test pack-------------------
            var uniqueId = Guid.NewGuid().ToString();
            var webPut   = new WebPutActivity()
            {
                UniqueID = uniqueId, PutData = "A"
            };
            var webPut1 = new WebPutActivity()
            {
                UniqueID = uniqueId, PutData = "A"
            };

            //---------------Assert Precondition----------------
            Assert.IsNotNull(webPut);
            //---------------Execute Test ----------------------
            var @equals = webPut.Equals(webPut1);

            //---------------Test Result -----------------------
            Assert.IsTrue(@equals);
        }
        public void WebPutActivity_Equals_Given_Different_QueryString_IsNOTEqual()
        {
            //---------------Set up test pack-------------------
            var uniqueId = Guid.NewGuid().ToString();
            var webPut   = new WebPutActivity()
            {
                UniqueID = uniqueId, QueryString = "A"
            };
            var webPut1 = new WebPutActivity()
            {
                UniqueID = uniqueId, QueryString = "B"
            };

            //---------------Assert Precondition----------------
            Assert.IsNotNull(webPut);
            //---------------Execute Test ----------------------
            var @equals = webPut.Equals(webPut1);

            //---------------Test Result -----------------------
            Assert.IsFalse(@equals);
        }
        public void WebPutActivity_Equals_Given_Same_IsPutDataBase64_IsEqual()
        {
            //---------------Set up test pack-------------------
            var uniqueId = Guid.NewGuid().ToString();
            var headers  = new List <INameValue> {
                new NameValue("a", "x")
            };
            var webPut = new WebPutActivity {
                UniqueID = uniqueId, Headers = headers, IsPutDataBase64 = true
            };
            var webPut1 = new WebPutActivity {
                UniqueID = uniqueId, Headers = headers, IsPutDataBase64 = true
            };

            //---------------Assert Precondition----------------
            Assert.IsNotNull(webPut);
            //---------------Execute Test ----------------------
            var equals = webPut.Equals(webPut1);

            //---------------Test Result -----------------------
            Assert.IsTrue(equals);
        }
Ejemplo n.º 17
0
 static WebPutActivityViewModel CreateViewModel(WebPutActivity act, MyWebModel mod)
 {
     return(new WebPutActivityViewModel(ModelItemUtils.CreateModelItem(act), mod));
 }