コード例 #1
0
        public void Given_WebActivityBackedByAModelItem_ExpectedTheServiceNamePropertySetsTheServiceNamePropertyOnTheModelItem()
        {
            DsfActivity Act = new DsfActivity();

            Act.ServiceName   = "testResource";
            Act.InputMapping  = @"<Inputs><Input Name=""Host"" Source=""Host"" DefaultValue=""mail.bellevuenet.co.za""><Validator Type=""Required"" /></Input><Input Name=""Port"" Source=""Port"" DefaultValue=""25""><Validator Type=""Required"" /></Input><Input Name=""From"" Source=""From"" DefaultValue=""*****@*****.**""><Validator Type=""Required"" /></Input><Input Name=""To"" Source=""To""><Validator Type=""Required"" /></Input><Input Name=""Subject"" Source=""Subject""><Validator Type=""Required"" /></Input><Input Name=""BodyType"" Source=""Bodytype"" DefaultValue=""html""><Validator Type=""Required"" /></Input><Input Name=""Body"" Source=""Body""><Validator Type=""Required"" /></Input><Input Name=""Attachment"" Source=""Attachment"" DefaultValue=""NONE""><Validator Type=""Required"" /></Input></Inputs>";
            Act.OutputMapping = @"<Outputs><Output Name=""FailureMessage"" MapsTo=""FailureMessage"" Value=""[[FailureMessage]]"" /><Output Name=""Message"" MapsTo=""Message"" Value=""[[Message]]"" /></Outputs>";
            ModelItem testItem = TestModelItemFactory.CreateModelItem(Act);

            string serviceName = "cake";

            IWebActivity webActivity = WebActivityFactory.CreateWebActivity(testItem, null, serviceName);

            Assert.AreEqual(serviceName, webActivity.ServiceName);
            Assert.AreEqual("DsfActivity", ModelItemUtils.GetProperty("DisplayName", testItem));
        }
コード例 #2
0
        public ActivityViewModelTO GetActivityViewModelTO(ModelItem modelItem)
        {
            ActivityViewModelTO result = new ActivityViewModelTO();

            var argument = ModelItemUtils.GetProperty("HelpLink", modelItem) as InArgument;

            if (argument != null)
            {
                result.HasHelpPage = !string.IsNullOrWhiteSpace(argument.Expression.ToString());
            }

            var inArgument1 = ModelItemUtils.GetProperty("ActionName", modelItem) as InArgument;

            if (inArgument1 != null)
            {
                result.Action = inArgument1.Expression.ToString();
            }

            var simulationMode = ModelItemUtils.GetProperty("SimulationMode", modelItem);

            if (simulationMode != null)
            {
                result.Simulation = simulationMode.ToString();
            }

            var inArgument = ModelItemUtils.GetProperty("FriendlySourceName", modelItem) as InArgument;

            if (inArgument != null)
            {
                result.SourceName = inArgument.Expression.ToString();
            }

            var inArgument2 = ModelItemUtils.GetProperty("Type", modelItem) as InArgument;

            if (inArgument2 != null)
            {
                result.Type = inArgument2.Expression.ToString();
            }

            //result.HasWizard = wizardEngine.HasWizard(modelItem, resource);
            return(result);
        }