public void ActivityUsedVar() { //Arrange Activity a1 = new Activity() { ActivityName = "a1" }; ActDummy act1 = new ActDummy(); a1.Acts.Add(act1); VariableString v1 = new VariableString() { InitialStringValue = "abc" }; a1.Variables.Add(v1); act1.Value = "{Var Name=v1}"; //Act List <string> usedVars = new List <string>(); VariableBase.GetListOfUsedVariables(a1, ref usedVars); //Assert Assert.AreEqual(1, usedVars.Count, "usedVars.Count"); Assert.AreEqual("v1", usedVars[0], "usedVars[0]=v1"); }
public void ThenSetValue_Perform_SetHttpHeadersTest() { string headersValue = "Cookie: Blah\nHost: www.google.com"; Mock <EventInfo> mockEventInfo = new Mock <EventInfo>(); Mock <HttpMessage> mockHttpMessage = new Mock <HttpMessage>(); Mock <VariableString> mockTextString = new Mock <VariableString>(It.IsAny <string>(), null); EventInfo eventInfo = mockEventInfo.Object; HttpMessage httpMessage = mockHttpMessage.Object; VariableString textString = mockTextString.Object; mockTextString.Setup(mock => mock.GetText(It.IsAny <Variables>())).Returns(headersValue); mockEventInfo.Setup(mock => mock.Message).Returns(httpMessage); mockHttpMessage.SetupSet(mock => mock.Headers = It.IsAny <HttpHeaders>()).Callback((HttpHeaders httpHeaders) => { Assert.AreEqual(headersValue, httpHeaders.ToString()); }); ThenSetValue then = new ThenSetValue() { Text = textString, DestinationMessageValue = MessageValue.HttpHeaders }; Assert.AreEqual(ThenResponse.Continue, then.Perform(eventInfo)); mockHttpMessage.VerifySet(mock => mock.Headers = It.IsAny <HttpHeaders>(), Times.Once); }
public void ThenSetValue_Perform_SetHttpVersionTest() { string textValue = "Http/2"; Mock <EventInfo> mockEventInfo = new Mock <EventInfo>(); Mock <HttpMessage> mockHttpMessage = new Mock <HttpMessage>(); Mock <HttpStatusLine> mockHttpStatusLine = new Mock <HttpStatusLine>(); Mock <VariableString> mockTextString = new Mock <VariableString>(It.IsAny <string>(), null); EventInfo eventInfo = mockEventInfo.Object; HttpMessage httpMessage = mockHttpMessage.Object; HttpStatusLine httpStatusLine = mockHttpStatusLine.Object; VariableString textString = mockTextString.Object; mockTextString.Setup(mock => mock.GetText(It.IsAny <Variables>())).Returns(textValue); mockEventInfo.Setup(mock => mock.Message).Returns(httpMessage); mockHttpMessage.Setup(mock => mock.StatusLine).Returns(httpStatusLine); mockHttpStatusLine.SetupSet(mock => mock.Version = It.IsAny <string>()); ThenSetValue then = new ThenSetValue() { Text = textString, DestinationMessageValue = MessageValue.HttpVersion }; Assert.AreEqual(ThenResponse.Continue, then.Perform(eventInfo)); mockHttpStatusLine.VerifySet(mock => mock.Version = It.IsAny <string>(), Times.Once); }
public void ThenSetValue_Perform_SetMessageTest() { string textValue = "Blah blah blah"; Mock <EventInfo> mockEventInfo = new Mock <EventInfo>(); Mock <Message> mockMessage = new Mock <Message>(); Mock <VariableString> mockTextString = new Mock <VariableString>(It.IsAny <string>(), null); EventInfo eventInfo = mockEventInfo.Object; Message message = mockMessage.Object; VariableString textString = mockTextString.Object; mockTextString.Setup(mock => mock.GetText(It.IsAny <Variables>())).Returns(textValue); mockEventInfo.Setup(mock => mock.Message).Returns(message); ThenSetValue then = new ThenSetValue() { Text = textString, DestinationMessageValue = MessageValue.Message }; Assert.AreEqual(ThenResponse.Continue, then.Perform(eventInfo)); mockMessage.VerifySet(mock => mock.RawText = textValue, Times.Once); mockMessage.Verify(mock => mock.ResetCheckedEntity(HttpMessage.EntityFlag), Times.Once); }
public void ThenSetValue_Perform_SetHttpMessageTest() { string httpTextValue = File.ReadAllText(@"TestFiles\HttpTestRequest.txt"); Mock <EventInfo> mockEventInfo = new Mock <EventInfo>(); Mock <HttpMessage> mockHttpMessage = new Mock <HttpMessage>(); Mock <VariableString> mockHttpTextString = new Mock <VariableString>(It.IsAny <string>(), null); EventInfo eventInfo = mockEventInfo.Object; HttpMessage httpMessage = mockHttpMessage.Object; VariableString httpTextString = mockHttpTextString.Object; mockHttpTextString.Setup(mock => mock.GetText(It.IsAny <Variables>())).Returns(httpTextValue); mockEventInfo.SetupGet(mock => mock.Message).Returns(httpMessage); mockEventInfo.SetupSet(mock => mock.Message = It.IsAny <Message>()).Callback((Message message) => { Assert.AreEqual(httpTextValue, message.ToString()); }); ThenSetValue then = new ThenSetValue() { Text = httpTextString, DestinationMessageValue = MessageValue.Message }; Assert.AreEqual(ThenResponse.Continue, then.Perform(eventInfo)); mockEventInfo.VerifySet(mock => mock.Message = It.IsAny <Message>(), Times.Once); }
public void ThenSetValue_Perform_SetHttpStatusLineTest() { string textValue = "GET https://www.telerik.com/UpdateCheck.aspx?isBeta=False HTTP/1.1"; Mock <EventInfo> mockEventInfo = new Mock <EventInfo>(); Mock <HttpMessage> mockHttpMessage = new Mock <HttpMessage>(); Mock <HttpStatusLine> mockHttpStatusLine = new Mock <HttpStatusLine>(); Mock <VariableString> mockTextString = new Mock <VariableString>(It.IsAny <string>(), null); EventInfo eventInfo = mockEventInfo.Object; HttpMessage httpMessage = mockHttpMessage.Object; HttpStatusLine httpStatusLine = mockHttpStatusLine.Object; VariableString textString = mockTextString.Object; mockTextString.Setup(mock => mock.GetText(It.IsAny <Variables>())).Returns(textValue); mockEventInfo.Setup(mock => mock.Message).Returns(httpMessage); mockHttpMessage.SetupSet(mock => mock.StatusLine = It.IsAny <HttpStatusLine>()).Callback((HttpStatusLine statusLine) => { Assert.AreEqual(textValue, statusLine.ToString()); }); ThenSetValue then = new ThenSetValue() { Text = textString, DestinationMessageValue = MessageValue.HttpStatusLine }; Assert.AreEqual(ThenResponse.Continue, then.Perform(eventInfo)); mockHttpMessage.VerifySet(mock => mock.StatusLine = It.IsAny <HttpStatusLine>(), Times.Once); }
private void UpdateActivityVars(Activity a, string Name) { if (a.Variables.Count == 0) { return; } string s = Name; int i = 0; while (s.Contains('%')) { i++; //TODO: user const for %p everywhere string num = General.GetStringBetween(s, "%p", " "); // in case of EOL then there might not be space, so we search from %p until end of line if (num == "") { int ii = s.IndexOf("%p"); num = s.Substring(ii + 2); } s = s.Replace("%p" + i, ""); VariableString v = (VariableString)a.GetVariable("p" + i); v.InitialStringValue = GetParamByIndex(a.ActivityName, int.Parse(num)); } }
public void ThenSetValue_Perform_SetHttpHeaderTest() { string identifierValue = "Cookie"; string headerValue = "value"; Mock <EventInfo> mockEventInfo = new Mock <EventInfo>(); Mock <HttpMessage> mockHttpMessage = new Mock <HttpMessage>(); Mock <HttpHeaders> mockHttpHeaders = new Mock <HttpHeaders>(); Mock <VariableString> mockTextString = new Mock <VariableString>(It.IsAny <string>(), null); Mock <VariableString> mockIdentifierString = new Mock <VariableString>(It.IsAny <string>(), null); EventInfo eventInfo = mockEventInfo.Object; HttpMessage httpMessage = mockHttpMessage.Object; HttpHeaders httpHeaders = mockHttpHeaders.Object; VariableString textString = mockTextString.Object; VariableString identifierString = mockIdentifierString.Object; mockTextString.Setup(mock => mock.GetText(It.IsAny <Variables>())).Returns(headerValue); mockEventInfo.Setup(mock => mock.Message).Returns(httpMessage); mockHttpMessage.Setup(mock => mock.Headers).Returns(httpHeaders); mockHttpHeaders.SetupSet(mock => mock[identifierValue] = It.IsAny <string>()); mockIdentifierString.Setup(mock => mock.GetText(It.IsAny <Variables>())).Returns(identifierValue); ThenSetValue then = new ThenSetValue() { Text = textString, DestinationIdentifier = identifierString, DestinationMessageValue = MessageValue.HttpHeader }; Assert.AreEqual(ThenResponse.Continue, then.Perform(eventInfo)); mockHttpHeaders.VerifySet(mock => mock[identifierValue] = headerValue, Times.Once); }
public void ActXMLProcessingTest() { //Arrange ActXMLProcessing action = new ActXMLProcessing(); var templateFile = TestResources.GetTestResourcesFile(@"XML\TemplateVU.xml"); action.GetOrCreateInputParam(ActXMLProcessing.Fields.TemplateFileName, templateFile); action.TemplateFileName.ValueForDriver = templateFile; var targetFile = TestResources.GetTestResourcesFile(@"XML\TargetFile.xml"); action.GetOrCreateInputParam(ActXMLProcessing.Fields.TargetFileName, targetFile); action.TargetFileName.ValueForDriver = targetFile; VariableString stringVar = new VariableString(); stringVar.Name = "env"; stringVar.Value = "xyz"; mBF.CurrentActivity.AddVariable(stringVar); ObservableList <ActInputValue> paramList = new ObservableList <ActInputValue>(); paramList.Add(new ActInputValue() { Param = "PAR_ENV", Value = "{Var Name=env}" }); paramList.Add(new ActInputValue() { Param = "PAR_USER", Value = "abc" }); paramList.Add(new ActInputValue() { Param = "PAR_PASS", Value = "abc123" }); paramList.Add(new ActInputValue() { Param = "PAR_BUCKET", Value = "pqrst" }); paramList.Add(new ActInputValue() { Param = "PAR_QUERY", Value = "test1234" }); action.DynamicElements = paramList; action.Active = true; action.AddNewReturnParams = true; mBF.CurrentActivity.Acts.Add(action); mBF.CurrentActivity.Acts.CurrentItem = action; //Act mGR.RunAction(action, false); //Assert Assert.AreEqual(eRunStatus.Passed, action.Status, "Action Status"); Assert.AreEqual(7, action.ReturnValues.Count); Assert.AreEqual("xyz", action.ReturnValues[0].Actual); Assert.AreEqual(action.Error, null, "Act.Error"); }
public void ThenSetValue_Perform_SetHttpBodyTest() { string textValue = "value"; Mock <EventInfo> mockEventInfo = new Mock <EventInfo>(); Mock <HttpMessage> mockHttpMessage = new Mock <HttpMessage>(); Mock <HttpBody> mockHttpBody = new Mock <HttpBody>(); Mock <VariableString> mockTextString = new Mock <VariableString>(It.IsAny <string>(), null); EventInfo eventInfo = mockEventInfo.Object; HttpMessage httpMessage = mockHttpMessage.Object; HttpBody httpBody = mockHttpBody.Object; VariableString textString = mockTextString.Object; mockTextString.Setup(mock => mock.GetText(It.IsAny <Variables>())).Returns(textValue); mockEventInfo.Setup(mock => mock.Message).Returns(httpMessage); mockHttpMessage.SetupSet(mock => mock.Body = It.IsAny <HttpBody>()).Callback((HttpBody body) => { Assert.AreEqual(textValue, body.Text); }); ThenSetValue then = new ThenSetValue() { Text = textString, DestinationMessageValue = MessageValue.HttpBody }; Assert.AreEqual(ThenResponse.Continue, then.Perform(eventInfo)); mockHttpMessage.VerifySet(mock => mock.Body = It.IsAny <HttpBody>(), Times.Once); }
public static void ClassInit(TestContext context) { mBF = new BusinessFlow(); mBF.Activities = new ObservableList <Activity>(); mBF.Name = "BF Test Fire Fox"; mBF.Active = true; Platform p = new Platform(); p.PlatformType = ePlatformType.Web; mBF.TargetApplications.Add(new TargetApplication() { AppName = "SCM" }); VariableString busFlowV1 = new VariableString() { Name = "BFV1", InitialStringValue = "1" }; mBF.AddVariable(busFlowV1); mGR = new GingerRunner(); mGR.Executor = new GingerExecutionEngine(mGR); mGR.Executor.CurrentSolution = new Ginger.SolutionGeneral.Solution(); Agent a = new Agent(); a.AgentType = Agent.eAgentType.Service; // Simple agent which anyhow we don't need to start for this test and will work on Linux ((GingerExecutionEngine)mGR.Executor).SolutionAgents = new ObservableList <Agent>(); ((GingerExecutionEngine)mGR.Executor).SolutionAgents.Add(a); mGR.ApplicationAgents.Add(new ApplicationAgent() { AppName = "SCM", Agent = a }); mGR.Executor.SolutionApplications = new ObservableList <ApplicationPlatform>(); mGR.Executor.SolutionApplications.Add(new ApplicationPlatform() { AppName = "SCM", Platform = ePlatformType.Web, Description = "New application" }); mGR.Executor.BusinessFlows.Add(mBF); WorkSpace.Init(new WorkSpaceEventHandler()); WorkSpace.Instance.RunningFromUnitTest = true; WorkSpace.Instance.SolutionRepository = GingerSolutionRepository.CreateGingerSolutionRepository(); string path = Path.Combine(TestResources.GetTestResourcesFolder(@"Solutions" + Path.DirectorySeparatorChar + "BasicSimple")); string solutionFile = System.IO.Path.Combine(path, @"Ginger.Solution.xml"); solution = SolutionOperations.LoadSolution(solutionFile); WorkSpace.Instance.SolutionRepository.Open(path); WorkSpace.Instance.Solution = solution; if (WorkSpace.Instance.Solution.SolutionOperations == null) { WorkSpace.Instance.Solution.SolutionOperations = new SolutionOperations(WorkSpace.Instance.Solution); } }
public void TestActivityVariablesSyncWithRepo_v2() { string variableName = "ACTVAR2"; string initialValue = "123"; string updatedValue = "abc123"; mBF = new BusinessFlow() { Name = "TestActvVarSyncV2", Active = true }; mBF.Activities = new ObservableList <Activity>(); VariableString V1 = new VariableString() { Name = variableName, InitialStringValue = initialValue }; // add variable to the activity Activity activity = new Activity() { ActivityName = "Activity1" }; activity.AddVariable(V1); mBF.Activities.Add(activity); // add business flow to the solution repository mSolutionRepository.AddRepositoryItem(mBF); // prepare to add the variable to the shared repository UploadItemSelection uploadItemSelection = new UploadItemSelection() { UsageItem = V1, ItemUploadType = UploadItemSelection.eItemUploadType.New }; (new SharedRepositoryOperations()).UploadItemToRepository(new Context() { BusinessFlow = mBF }, uploadItemSelection); // find the newly added variable in the shared repo VariableBase sharedVariableBase = (from x in mSolutionRepository.GetAllRepositoryItems <VariableBase>() where x.Name == variableName select x).SingleOrDefault(); VariableString sharedV1 = (VariableString)sharedVariableBase; //update the new value in the shared repo variable sharedV1.InitialStringValue = updatedValue; //sync the updated instance with the business flow instance sharedV1.UpdateInstance(V1, "All", mBF.Activities[0]); // get the updated value from the business flow VariableString V2 = (VariableString)mBF.Activities[0].Variables[0]; //Assert Assert.AreEqual(1, mBF.Activities.Count); Assert.AreEqual(1, mBF.Activities[0].Variables.Count); Assert.AreNotSame(V1, V2); Assert.AreEqual(updatedValue, V2.InitialStringValue); }
private VariableString GetMockVariableString(string returnValue) { Mock <VariableString> mockMatchTextString = new Mock <VariableString>(It.IsAny <string>(), null); VariableString matchTextString = mockMatchTextString.Object; mockMatchTextString.Setup(mock => mock.GetText(It.IsAny <Variables>())).Returns(returnValue); return(matchTextString); }
private void AddNewVariable() { var e = new VariableString(); e.Init("new var"); actualLevel.AddVariable(e); }
public void BizFlowSaveLoad() { //Arrange int ActivitiesToCreate = 5; //Act BusinessFlow BF = new BusinessFlow(); BF.Name = "Biz flow 1"; BF.Description = "Desc 1"; //BF.Status = BusinessFlow.eBusinessFlowStatus.Active; //TODOL do NOT write to XML if null or empty BF.Activities = new ObservableList <Activity>(); for (int i = 1; i <= ActivitiesToCreate; i++) { Activity a = new Activity(); a.ActivityName = "Activity number " + i; a.Description = "Desc - " + i; BF.Activities.Add(a); a.Status = eRunStatus.Passed; for (int j = 1; j <= 2; j++) { ActTextBox t = new ActTextBox(); t.Description = "Set text box " + j; t.LocateBy = eLocateBy.ByID; t.LocateValue = "ID" + j; a.Acts.Add(t); ActGotoURL g = new ActGotoURL(); g.Description = "goto URL " + j; g.LocateValue = "ID" + j; a.Acts.Add(g); } } VariableString v = new VariableString(); v.Name = "Var1"; v.Description = "VDesc 1"; BF.AddVariable(v); string FileName = TestResources.GetTempFile("bf1.xml"); BF.RepositorySerializer.SaveToFile(BF, FileName); // Assert NewRepositorySerializer newRepositorySerializer = new NewRepositorySerializer(); BusinessFlow BF2 = (BusinessFlow)newRepositorySerializer.DeserializeFromFile(typeof(BusinessFlow), FileName); Assert.AreEqual(BF2.Name, BF.Name); Assert.AreEqual(BF2.Description, BF.Description); Assert.AreEqual(BF2.Activities.Count, ActivitiesToCreate); Assert.AreEqual(BF2.Variables.Count, 1); //Validations }
public void SetMessageValue(EventInfo eventInfo, string value, string messageValue, string messageValueType, string identifier) { MessageValueHandler handler = new MessageValueHandler(); MessageValue rawMessageValue = (MessageValue)GetStringAsEnum <MessageValue>(messageValue); MessageValueType rawMessageValueType = (MessageValueType)GetStringAsEnum <MessageValueType>(messageValueType); VariableString rawIdentifier = (identifier == null) ? null : VariableString.GetAsVariableString(identifier, false); handler.SetValue(eventInfo, rawMessageValue, rawMessageValueType, rawIdentifier, value); }
public string Connect(string destinationHost, int?destinationPort) { ThenConnect then = new ThenConnect() { DestinationHost = (destinationHost == null) ? null : VariableString.GetAsVariableString(destinationHost.ToString(), false), DestinationPort = (destinationPort == null) ? null : VariableString.GetAsVariableString(destinationPort.ToString(), false) }; return(then.Perform(eventInfo).ToString()); }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { VariableString varStr = null; if (value != null) { varStr = VariableString.GetAsVariableString(value.ToString()); } return(varStr); }
public void BizFlowAddActivitiesFromSharedRepoSaveLoad() { //Arrange int ActivitiesToCreate = 5; string FileName = TestResources.GetTempFile("BFSaveLoad.xml"); BusinessFlow BF = new BusinessFlow() { Name = "Biz flow 1", Description = "Desc 1" }; BF.Activities = new ObservableList <Activity>(); for (int i = 1; i <= ActivitiesToCreate; i++) { Activity a = new Activity() { ActivityName = "Activity " + i, Description = "desc" + i, Status = eRunStatus.Passed }; BF.AddActivity(a); //for (int j = 1; j <= 2; j++) //{ // ActTextBox t = new ActTextBox(); // t.Description = "Set text box " + j; // t.LocateBy = Act.eLocatorType.ByID; // t.LocateValue = "ID" + j; // a.Acts.Add(t); // ActGotoURL g = new ActGotoURL(); // g.Description = "goto URL " + j; // g.LocateValue = "ID" + j; // a.Acts.Add(g); //} } VariableString v = new VariableString(); v.Name = "Var1"; v.Description = "VDesc 1"; BF.AddVariable(v); //ValidationDB vdb = new ValidationDB() { Description ="DBV1", Expected ="exp1" }; //BF.Activities[0].Asserts.Add(vdb); //Act BF.RepositorySerializer.SaveToFile(BF, FileName); // Assert NewRepositorySerializer newRepositorySerializer = new NewRepositorySerializer(); BusinessFlow BF2 = (BusinessFlow)newRepositorySerializer.DeserializeFromFile(typeof(BusinessFlow), FileName); Assert.AreEqual(BF2.Activities.Count(), ActivitiesToCreate); //Assert.AreEqual(BF2. Activities[0].Asserts.Count(), 1); //BF2.Description = "aaa"; }
public void TestRunsetConfigBFVariables() { //Arrange ObservableList <BusinessFlow> bfList = SR.GetAllRepositoryItems <BusinessFlow>(); BusinessFlow BF1 = bfList[0]; ObservableList <Activity> activityList = BF1.Activities; Activity activity = activityList[0]; ActDummy act1 = new ActDummy() { Value = "", Active = true }; activity.Acts.Add(act1); VariableString v1 = new VariableString() { Name = "v1", InitialStringValue = "aaa" }; BF1.AddVariable(v1); BF1.Active = true; mGR.BusinessFlows.Add(BF1); //Adding Same Business Flow Again to GingerRunner BusinessFlow bfToAdd = (BusinessFlow)BF1.CreateCopy(false); bfToAdd.ContainingFolder = BF1.ContainingFolder; bfToAdd.Active = true; bfToAdd.Reset(); bfToAdd.InstanceGuid = Guid.NewGuid(); mGR.BusinessFlows.Add(bfToAdd); WorkSpace.Instance.SolutionRepository = SR; //Act //Changing initial value of 2nd BF from BusinessFlow Config mGR.BusinessFlows[2].Variables[0].Value = "bbb"; mGR.BusinessFlows[2].Variables[0].DiffrentFromOrigin = true; mGR.RunRunner(); //Assert Assert.AreEqual(BF1.RunStatus, eRunStatus.Passed); Assert.AreEqual(activity.Status, eRunStatus.Passed); Assert.AreEqual(bfToAdd.RunStatus, eRunStatus.Passed); Assert.AreEqual(mGR.BusinessFlows[1].Variables[0].Value, "aaa"); Assert.AreEqual(mGR.BusinessFlows[2].Variables[0].Value, "bbb"); }
private void tviAddNewVarTreeItem_MouseDoubleClick(object sender, MouseButtonEventArgs e) { VariableString newStringVar = new VariableString(); eVariablesLevel varLevel = (eVariablesLevel)((sender as TreeViewItem).Tag); switch (varLevel) { case eVariablesLevel.Solution: ((Solution)App.UserProfile.Solution).AddVariable(newStringVar); break; case eVariablesLevel.BusinessFlow: ((BusinessFlow)App.BusinessFlow).AddVariable(newStringVar); break; case eVariablesLevel.Activity: ((Activity)App.BusinessFlow.CurrentActivity).AddVariable(newStringVar); break; } VariableEditPage varEditPage = new VariableEditPage(newStringVar); varEditPage.ShowAsWindow(eWindowShowStyle.Dialog); //make sure name is unique switch (varLevel) { case eVariablesLevel.Solution: ((Solution)App.UserProfile.Solution).SetUniqueVariableName(newStringVar); break; case eVariablesLevel.BusinessFlow: ((BusinessFlow)App.BusinessFlow).SetUniqueVariableName(newStringVar); break; case eVariablesLevel.Activity: ((Activity)App.BusinessFlow.CurrentActivity).SetUniqueVariableName(newStringVar); break; } if (newStringVar != null) { TreeViewItem newTvi = new TreeViewItem(); string VarExpression = "{Var Name=" + newStringVar.Name + "}"; SetItemView(newTvi, newStringVar.Name, VarExpression, "@Variable_16x16.png"); TreeViewItem parentTvi = (TreeViewItem)((TreeViewItem)xObjectsTreeView.SelectedItem).Parent; parentTvi.Items.Insert(parentTvi.Items.Count - 1, newTvi); //TODO: make added variable as selected item //newTvi.IsSelected = true;//Not working newTvi.MouseDoubleClick += tvi_MouseDoubleClick; AddExpToValue(newTvi.Tag + ""); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { VariableString varStr = value as VariableString; string convertedValue = null; if (varStr != null) { convertedValue = varStr?.GetFormattedString(); } return(convertedValue); }
public void StringVar_TestImageType() { //Arrange VariableString variableString = new VariableString(); //Act eImageType eImageType = variableString.Image; //Assert Assert.AreEqual(eImageType.Label, eImageType, "Image Type"); }
public void StringVar_TestVariableType() { //Arrange VariableString variableString = new VariableString(); //Act string varType = variableString.VariableType; //Assert Assert.AreEqual("String", varType, "String Variable Type"); }
public string AddMessage(string direction, string messageText, bool insertAtBeginning) { ThenAddMessage then = new ThenAddMessage() { Direction = (DataDirection)GetStringAsEnum <DataDirection>(direction), MessageText = VariableString.GetAsVariableString(messageText, false), InsertAtBeginning = insertAtBeginning }; return(then.Perform(eventInfo).ToString()); }
public void BizFlowCheckIsDirtyTrue() { //Arrange int ActivitiesToCreate = 2; string TempFilepath = TestResources.GetTempFile("bfIsDirtyTrue.xml"); BusinessFlow BF = new BusinessFlow(); BF.Name = "Biz flow 1"; BF.Description = "Desc 1"; //BF.Status = BusinessFlow.eBusinessFlowStatus.Active; //TODOL do NOT write to XML if null or empty BF.Activities = new ObservableList <Activity>(); for (int i = 1; i <= ActivitiesToCreate; i++) { Activity a = new Activity(); a.ActivityName = "Activity number " + i; a.Description = "Desc - " + i; BF.Activities.Add(a); a.Status = eRunStatus.Passed; for (int j = 1; j <= 2; j++) { ActTextBox t = new ActTextBox(); t.Description = "Set text box " + j; t.LocateBy = eLocateBy.ByID; t.LocateValue = "ID" + j; a.Acts.Add(t); ActGotoURL g = new ActGotoURL(); g.Description = "goto URL " + j; g.LocateValue = "ID" + j; a.Acts.Add(g); } } VariableString v = new VariableString(); v.Name = "Var1"; v.Description = "VDesc 1"; BF.AddVariable(v); //Act BF.RepositorySerializer.SaveToFile(BF, TempFilepath); // Assert NewRepositorySerializer newRepositorySerializer = new NewRepositorySerializer(); BusinessFlow BF2 = (BusinessFlow)newRepositorySerializer.DeserializeFromFile(typeof(BusinessFlow), TempFilepath); BF2.StartDirtyTracking(); BF2.Description = "aaa"; Assert.IsTrue(BF2.DirtyStatus == Amdocs.Ginger.Common.Enums.eDirtyStatus.Modified); }
public void BizFlowCheckIsDirtyTrue() { //Arrange int ActivitiesToCreate = 2; string TempFilepath = TestResources.GetTempFile("bfIsDirtyTrue.xml"); BusinessFlow BF = new BusinessFlow(); BF.Name = "Biz flow 1"; BF.Description = "Desc 1"; //BF.Status = BusinessFlow.eBusinessFlowStatus.Active; //TODOL do NOT write to XML if null or empty BF.Activities = new ObservableList <Activity>(); for (int i = 1; i <= ActivitiesToCreate; i++) { Activity a = new Activity(); a.ActivityName = "Activity number " + i; a.Description = "Desc - " + i; BF.Activities.Add(a); a.Status = eRunStatus.Passed; for (int j = 1; j <= 2; j++) { ActTextBox t = new ActTextBox(); t.Description = "Set text box " + j; t.LocateBy = eLocateBy.ByID; t.LocateValue = "ID" + j; a.Acts.Add(t); ActGotoURL g = new ActGotoURL(); g.Description = "goto URL " + j; g.LocateValue = "ID" + j; a.Acts.Add(g); } } VariableString v = new VariableString(); v.Name = "Var1"; v.Description = "VDesc 1"; BF.AddVariable(v); //Act BF.SaveToFile(TempFilepath); // Assert BusinessFlow BF2 = (BusinessFlow)RepositoryItem.LoadFromFile(typeof(BusinessFlow), TempFilepath); BF2.SaveBackup();//dirty now just indicate if backup exist BF2.Description = "aaa"; Assert.IsTrue(BF2.IsDirty); }
public void StringVar_TestVariableUIType() { //Arrange VariableString variableString = new VariableString(); //Act GingerTerminology.TERMINOLOGY_TYPE = eTerminologyType.Default; string varType = variableString.VariableUIType; //Assert Assert.AreEqual("Variable String", varType, "String Variable UI Type"); }
private void CreateVariables() { foreach (KeyValuePair <string, string> entry in Dictionary_Variables) { VariableString v = new VariableString(); v.Description = GingerDicser.GetTermResValue(eTermResKey.Variable) + " added from Calendar"; v.Name = entry.Key; v.Value = entry.Value; v.CreateCopy(); mBusinessFlow.AddVariable(v); } }
public void StringVar_TestVal() { //Arrange VariableString variableString = new VariableString(); variableString.Name = "test"; variableString.Value = "testVal"; //Act //Assert Assert.AreEqual("testVal", variableString.Value, "String Value"); }