示例#1
0
        public void PluginSay()
        {
            //Arrange
            ResetBusinessFlow();
            WorkSpace.Instance.LocalGingerGrid.NodeList.Clear();

            Activity a1 = new Activity()
            {
                Active = true, TargetApplication = mAppName
            };

            mBusinessFlow.Activities.Add(a1);

            ActPlugIn act1 = new ActPlugIn()
            {
                PluginId = "Memo", ServiceId = "MemoService", ActionId = "Say", Active = true
            };

            act1.AddOrUpdateInputParamValue("text", "hello");
            a1.Acts.Add(act1);

            //Act
            mGingerRunner.RunRunner();
            string outVal = act1.GetReturnValue("I said").Actual;

            //Assert
            Assert.AreEqual("hello", outVal, "outVal=hello");
            Assert.AreEqual(eRunStatus.Passed, mBusinessFlow.RunStatus);
            Assert.AreEqual(eRunStatus.Passed, a1.Status);
        }
示例#2
0
        public void SpeedTest()
        {
            //Arrange
            ResetBusinessFlow();
            WorkSpace.Instance.LocalGingerGrid.NodeList.Clear();

            Activity activitiy1 = new Activity()
            {
                Active = true, TargetApplication = mAppName
            };

            mBusinessFlow.Activities.Add(activitiy1);

            for (int i = 0; i < 1000; i++)
            {
                ActPlugIn act1 = new ActPlugIn()
                {
                    PluginId = "Memo", ServiceId = "MemoService", ActionId = "Say", Active = true
                };
                act1.AddOrUpdateInputParamValue("text", "hello " + i);
                activitiy1.Acts.Add(act1);
            }

            //Act
            mGingerRunner.RunRunner();


            //Assert
            Assert.AreEqual(mBusinessFlow.RunStatus, eRunStatus.Passed, "mBF.RunStatus");
            Assert.AreEqual(eRunStatus.Passed, activitiy1.Status);
            Assert.IsTrue(activitiy1.Elapsed < 20000, "a0.Elapsed Time less than 20000ms/10sec");
        }
示例#3
0
 private void GingerAction_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (((ActionParam)sender).Value != null)
     {
         mAct.AddOrUpdateInputParamValue(((ActionParam)sender).Name, ((ActionParam)sender).Value.ToString());
     }
 }
示例#4
0
        public void MemoPluginSpeedTest()
        {
            // Reporter.ToConsole(eLogLevel.INFO, ">>>>> test MemoPluginSpeedTest <<<<<<<<<");
            Console.WriteLine(">>>>> test MemoPluginSpeedTest <<<<<<<<<");

            lock (mBusinessFlow)
            {
                //Arrange
                ResetBusinessFlow();

                Activity activitiy1 = new Activity()
                {
                    Active = true, TargetApplication = mAppName
                };
                mBusinessFlow.Activities.Add(activitiy1);

                int count = 100;

                for (int i = 0; i < count; i++)
                {
                    ActPlugIn act1 = new ActPlugIn()
                    {
                        PluginId = "Memo", ServiceId = "SpeechService", ActionId = "Say", Active = true
                    };
                    act1.AddOrUpdateInputParamValue("text", "hello " + i);
                    activitiy1.Acts.Add(act1);
                }

                //Act
                mGingerRunner.RunRunner();


                //Assert
                for (int i = 0; i < count; i++)
                {
                    Assert.AreEqual(eRunStatus.Passed, activitiy1.Acts[i].Status, "Status of Act #" + i);
                }
                Assert.AreEqual(eRunStatus.Passed, activitiy1.Status);
                Assert.IsTrue(activitiy1.Elapsed < 20000, "a0.Elapsed Time less than 20000ms/20sec");
            }
        }
示例#5
0
        public void PluginSay()
        {
            mTestHelper.Log("test PluginSay");

            lock (mBusinessFlow)
            {
                //Arrange
                ResetBusinessFlow();

                Activity a1 = new Activity()
                {
                    Active = true, TargetApplication = mAppName
                };
                mBusinessFlow.Activities.Add(a1);

                ActPlugIn act1 = new ActPlugIn()
                {
                    PluginId = "Memo", ServiceId = "SpeechService", ActionId = "Say", Active = true, AddNewReturnParams = true
                };
                act1.AddOrUpdateInputParamValue("text", "hello");
                a1.Acts.Add(act1);

                //Act
                mTestHelper.Log("Before Ginger Runner");
                mGingerRunner.RunRunner();
                // mGingerRunner.CloseAgents();
                mTestHelper.Log("After Ginger Runner");

                //Assert
                Assert.AreEqual(eRunStatus.Passed, act1.Status);
                Assert.AreEqual(eRunStatus.Passed, a1.Status);
                Assert.AreEqual(eRunStatus.Passed, mBusinessFlow.RunStatus);
                string outVal = act1.GetReturnValue("I said").Actual;
                Assert.AreEqual("hello", outVal, "outVal=hello");
            }
        }
示例#6
0
        private void LoadEditPage()
        {
            try
            {
                // Edit Page can be .xaml or a classname of a page, or empty if no config needed
                PlugInWrapper PIW      = App.LocalRepository.GetSolutionPlugIns().Where(x => x.ID == mAct.PlugInID).FirstOrDefault();
                string        editpage = string.Empty;
                if (PIW != null)
                {
                    editpage = PIW.GetEditPage(mAct.PlugInActionID);
                }

                if (string.IsNullOrEmpty(editpage))
                {
                    EditFrame.Visibility     = Visibility.Collapsed;
                    NoConfigLabel.Visibility = Visibility.Visible;
                    // There is no Edit page configured = action without params in
                    return;
                }

                NoConfigLabel.Visibility = Visibility.Collapsed;


                if (editpage.EndsWith(".xaml", StringComparison.OrdinalIgnoreCase))
                {
                    if (!File.Exists(editpage))
                    {
                        EditFrame.Content = "Error: xaml file not found - " + editpage;
                        return;
                    }

                    FileStream s           = new FileStream(editpage, FileMode.Open);
                    UIElement  rootElement = (UIElement)XamlReader.Load(s);
                    s.Close();

                    EditFrame.Content = rootElement;

                    BindControlsToAction((Panel)rootElement);
                }
                else
                {
                    Type t = PIW.Assembly.GetType(editpage);
                    if (t == null)
                    {
                        EditFrame.Content = "Error: Action edit page not found - " + editpage;
                        return;
                    }

                    Page p = (Page)Activator.CreateInstance(t, mAct.GingerAction);

                    foreach (ActionParam AP in mAct.GingerAction.ParamsIn)
                    {
                        mAct.AddOrUpdateInputParamValue(AP.Name, AP.Value == null? string.Empty : AP.Value.ToString());
                        AP.PropertyChanged -= GingerAction_PropertyChanged;
                        AP.PropertyChanged += GingerAction_PropertyChanged;
                    }
                    EditFrame.Content = p;
                }
            }
            catch (Exception ex)
            {
                LoadErrorLbl.Visibility = Visibility.Visible;
                EditFrame.Visibility    = Visibility.Collapsed;
                Reporter.ToLog(eLogLevel.ERROR, "Failed to load the plugin edit page for the action '" + mAct.Description + "'", ex);
            }
        }