예제 #1
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");
        }
예제 #2
0
        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);
            }
        }
예제 #4
0
        public override IList <IToolRegion> BuildRegions()
        {
            IList <IToolRegion> regions = new List <IToolRegion>();

            if (SourceRegion == null)
            {
                SourceRegion = new WebSourceRegion(Model, ModelItem)
                {
                    SourceChangedAction = () => { OutputsRegion.IsEnabled = false; }
                };
                regions.Add(SourceRegion);
                InputArea = new WebDeleteInputRegion(ModelItem, SourceRegion);
                regions.Add(InputArea);
                OutputsRegion = new OutputsRegion(ModelItem, true);
                regions.Add(OutputsRegion);
                if (OutputsRegion.Outputs.Count > 0)
                {
                    OutputsRegion.IsEnabled = true;
                }
                ErrorRegion = new ErrorRegion();
                regions.Add(ErrorRegion);
                SourceRegion.Dependants.Add(InputArea);
                SourceRegion.Dependants.Add(OutputsRegion);
            }
            regions.Add(ManageServiceInputViewModel);
            Regions = regions;
            return(regions);
        }
예제 #5
0
        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);
        }
예제 #6
0
        public void WebDeleteInputRegion_TestInputCtorEmpty()
        {
            var mod = new Mock <IWebServiceModel>();

            mod.Setup(a => a.RetrieveSources()).Returns(new List <IWebServiceSource>());
            var region = new WebDeleteInputRegion();

            Assert.AreEqual(region.IsEnabled, false);
        }
예제 #7
0
        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);
        }