private ActivityPlan GetTestPlanFromBusinessFlow(BusinessFlow businessFlow) { ActivityPlan testPlan = new ActivityPlan(); //Check if updating or creating new instance in RQM if (!string.IsNullOrEmpty(businessFlow.ExternalID)) { try { long rqmID = Convert.ToInt64(GetExportedIDString(businessFlow.ExternalID, "RQMID")); //getExportID(businessFlow.ExternalID); if (rqmID != 0) { testPlan.ExportedID = rqmID; testPlan.ShouldUpdated = true; } } catch (Exception e) { testPlan.ShouldUpdated = false; Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {e.Message}"); } } testPlan.EntityName = businessFlow.Name; testPlan.EntityDesc = businessFlow.Description == null ? "" : businessFlow.Description; //Add custom properties Dictionary <string, string> ActivityLevelproperties = GetCustomProperties("TestPlan"); testPlan.CustomProperties = ActivityLevelproperties; return(testPlan); }
public IActionResult DeleteActivty(int ActivityPlanID) { ActivityPlan deleteMe = _context.ActivityPlans.SingleOrDefault(a => a.ActivityPlanID == ActivityPlanID); _context.Remove(deleteMe); _context.SaveChanges(); return(RedirectToAction("ShowDashboard")); }
public ActivityPlanViewModel(ActivityPlan plan) : this() { _isEdit = true; _editedPlan = plan; Name = plan.Name; foreach (var selectedActivity in plan.ActivityPlanActivities) { SelectedActivities.Add(selectedActivity); } }
public static TextComment Create(string content, ActivityPlan activityPlan, User owner) { return(new TextComment { Text = content, ActivityPlan = activityPlan, ActivityPlanId = activityPlan.Id, Owner = owner, OwnerId = owner.Id }); }
public static Rating Create(RatingStatus ratingStatus, ActivityPlan activityPlan, User owner) { return(new Rating { RatingStatus = ratingStatus, ActivityPlan = activityPlan, ActivityPlanId = activityPlan.Id, Owner = owner, OwnerId = owner.Id }); }
public static InternalImageComment Create(Image image, ActivityPlan activityPlan, User owner) { return(new InternalImageComment { Image = image, ImageId = image.Id, ActivityPlan = activityPlan, ActivityPlanId = activityPlan.Id, Owner = owner, OwnerId = owner.Id }); }
public void Post_Creates_New_ActivityPlan() { var newActivityPlan = new ActivityPlan(1, "title", "agerange", "description", 50, 50, 1); var ActivityPlanList = new List <ActivityPlan>(); activityPlanRepo.When(t => t.Create(newActivityPlan)) .Do(t => ActivityPlanList.Add(newActivityPlan)); activityPlanRepo.GetAll().Returns(ActivityPlanList); var result = underTest.Post(newActivityPlan); Assert.Contains(newActivityPlan, result); }
public async Task <EntityDto <Guid> > CreateActivityPlan(CreateActivityPlanInput input) { var currentUser = await GetCurrentUserAsync(); var tags = await _tagManager.GetTags(input.TagTexts); var activityPlan = await _activityPlanManager.CreateAsync(ActivityPlan.Create( input.Name, tags, currentUser )); return(new EntityDto <Guid>(activityPlan.Id)); }
public static TextDescription Create(string text, ActivityPlan activityPlan, long createUserId) { if (createUserId != activityPlan.OwnerId) { throw new UserFriendlyException($"You are not allowed to create a text description in this activity plan with id = {activityPlan.Id}."); } return(new TextDescription { Text = text, ActivityPlan = activityPlan, ActivityPlanId = activityPlan.Id }); }
public void EditDescriptions(ActivityPlan activityPlan, long[] descriptionIds, long editUserId) { var activityPlanDescriptions = activityPlan.Descriptions; foreach (var activityPlanDescription in activityPlanDescriptions) { for (var i = 0; i < descriptionIds.Length; i++) { if (descriptionIds[i] == activityPlanDescription.Id) { activityPlanDescription.EditPriority(i, editUserId); } } } }
public async Task <Rating> CreateAsync(RatingStatus ratingStatus, ActivityPlan activityPlan, User owner) { var rating = activityPlan.Ratings.FirstOrDefault(r => r.OwnerId == owner.Id && r.ActivityPlanId == activityPlan.Id); if (rating != null) { rating.EditRating(ratingStatus, owner.Id); } else { rating = await CreateAsync(Rating.Create(ratingStatus, activityPlan, owner)); } return(rating); }
public static InternalImageDescription Create(Image image, ActivityPlan activityPlan, long createUserId) { if (createUserId != activityPlan.OwnerId) { throw new UserFriendlyException($"You are not allowed to create a internal description in this activity plan with id = {activityPlan.Id}."); } return(new InternalImageDescription { Image = image, ImageId = image.Id, ActivityPlan = activityPlan, ActivityPlanId = activityPlan.Id }); }
public static ExternalImageDescription Create(string path, ActivityPlan activityPlan, long createUserId) { if (createUserId != activityPlan.OwnerId) { throw new UserFriendlyException($"You are not allowed to create a external image description in this activity plan with id = {activityPlan.Id}."); } var uri = new Uri(path); return(new ExternalImageDescription { Path = uri.Host + uri.PathAndQuery, ActivityPlan = activityPlan, ActivityPlanId = activityPlan.Id }); }
public void Put_Updates_ActivityPlan() { var originalActivityPlan = new ActivityPlan(1, "title", "agerange", "description", 50, 50, 1); var expectedActivityPlan = new List <ActivityPlan>() { originalActivityPlan }; var updatedActivityPlan = new ActivityPlan(1, "2title", "2agerange", "2description", 250, 250, 1); activityPlanRepo.When(t => activityPlanRepo.Update(updatedActivityPlan)) .Do(Callback.First(t => expectedActivityPlan.Remove(originalActivityPlan)) .Then(t => expectedActivityPlan.Add(updatedActivityPlan))); activityPlanRepo.GetAll().Returns(expectedActivityPlan); var result = underTest.Put(updatedActivityPlan); Assert.Equal(expectedActivityPlan, result.ToList()); }
public IActionResult CreateActivityPlan(ActivityPlanViewModel AnActivityPlan) { if (ModelState.IsValid) { ActivityPlan AddActivityPlan = new ActivityPlan { Title = AnActivityPlan.Title, StartDate = AnActivityPlan.StartDate, Duration = AnActivityPlan.Duration, DurationType = AnActivityPlan.DurationType, Description = AnActivityPlan.Description, UserID = (int)HttpContext.Session.GetInt32("logged_id") }; _context.ActivityPlans.Add(AddActivityPlan); _context.SaveChanges(); return(RedirectToAction("ShowDashboard")); } return(View("ActivityForm")); }
public void Delete_Removes_ActivityPlan() { var ActivityPlanID = 1; var deletedActivityPlan = new ActivityPlan(1, "title", "agerange", "description", 50, 50, 1); var activityPlanList = new List <ActivityPlan>() { deletedActivityPlan, new ActivityPlan(2, "2title", "2agerange", "2description", 250, 250, 2) }; activityPlanRepo.GetById(ActivityPlanID).Returns(deletedActivityPlan); activityPlanRepo.When(d => d.Delete(deletedActivityPlan)) .Do(d => activityPlanList.Remove(deletedActivityPlan)); activityPlanRepo.GetAll().Returns(activityPlanList); var result = underTest.Delete(ActivityPlanID); Assert.DoesNotContain(deletedActivityPlan, result); //Assert.All(result, item => Assert.Contains("second item", item.Title)); }
public ActionResult SaveActivity() { var request = Request.Form; var id = request.GetValues("id"); ActivityPlan itemToSave = null; if (id != null) { var intId = int.Parse(id[0]); itemToSave = calendarContext.ActivityPlans.FirstOrDefault(o => o.Id == intId); } if (itemToSave == null) { itemToSave = new ActivityPlan(); } itemToSave.Description = request.Get("Description"); itemToSave.Date = DateTime.Parse(request.Get("Date")); itemToSave.Type = (ActivityType)Enum.Parse(typeof(ActivityType), request.Get("Type")); itemToSave.ActivityName = request.Get("ActivityName"); itemToSave.UserId = request.Get("UserId"); if (itemToSave.Id == 0) { calendarContext.ActivityPlans.Add(itemToSave); } else { calendarContext.ActivityPlans.AddOrUpdate(itemToSave); } calendarContext.SaveChanges(); return(RedirectToActionPermanent("Index")); }
public bool ExportBusinessFlowToRQM(BusinessFlow businessFlow, ObservableList <ExternalItemFieldBase> ExternalItemsFields, ref string result) { mExternalItemsFields = ExternalItemsFields; LoginDTO loginData = new LoginDTO() { User = ALMCore.AlmConfig.ALMUserName, Password = ALMCore.AlmConfig.ALMPassword, Server = ALMCore.AlmConfig.ALMServerURL }; //ActivityPlan is TestPlan in RQM and BusinessFlow in Ginger List <IActivityPlan> testPlanList = new List <IActivityPlan>(); //1 ActivityPlan testPlan = GetTestPlanFromBusinessFlow(businessFlow); testPlanList.Add(testPlan);//2 if (businessFlow.ActivitiesGroups.Count == 0) { throw new Exception(GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " must have at least one " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup)); } ResultInfo resultInfo; try { //Create (RQM)TestCase for each Ginger ActivityGroup and add it to RQM TestCase List testPlan.Activities = new List <IActivityModel>();//3 foreach (ActivitiesGroup ag in businessFlow.ActivitiesGroups) { testPlan.Activities.Add(GetTestCaseFromActivityGroup(ag)); } RQMConnect.Instance.RQMRep.GetConection(); resultInfo = RQMConnect.Instance.RQMRep.ExportTestPlan(loginData, testPlanList, ALMCore.AlmConfig.ALMServerURL, RQMCore.ALMProjectGuid, ALMCore.AlmConfig.ALMProjectName, RQMCore.ALMProjectGroupName, null); } catch (Exception ex) { result = "Failed to export the Business Flow to RQM/ALM " + ex.Message; Reporter.ToLog(eLogLevel.ERROR, "Failed to export the Business Flow to RQM/ALM", ex); return(false); } // Deal with response from RQM after export // 0 = sucsess , 1 = failed if (resultInfo.ErrorCode == 0) { foreach (ActivityPlan plan in testPlanList) { businessFlow.ExternalID = "RQMID=" + plan.ExportedID.ToString(); int ActivityGroupCounter = 0; int activityStepCounter = 0; int activityStepOrderID = 1; foreach (ACL_Data_Contract.Activity act in plan.Activities) { string ActivityGroupID = "RQMID=" + act.ExportedID.ToString() + "|RQMScriptID=" + act.ExportedTestScriptId.ToString() + "|RQMRecordID=" + act.ExportedTcExecutionRecId.ToString() + "|AtsID=" + act.EntityId.ToString(); businessFlow.ActivitiesGroups[ActivityGroupCounter].ExternalID = ActivityGroupID; foreach (ACL_Data_Contract.ActivityStep activityStep in act.ActivityData.ActivityStepsColl) { //string activityStepID = "RQMID=" + activityStepOrderID.ToString() + "|AtsID=" + act.EntityId.ToString(); string activityStepID = "RQMID=" + act.ExportedTestScriptId.ToString() + "_" + activityStepOrderID + "|AtsID=" + act.EntityId.ToString(); businessFlow.Activities[activityStepCounter].ExternalID = activityStepID; activityStepCounter++; activityStepOrderID++; } activityStepOrderID = 0; ActivityGroupCounter++; } } return(true); } else { result = "Failed to export the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " to RQM/ALM, " + resultInfo.ErrorDesc; Reporter.ToLog(eLogLevel.ERROR, "Failed to export the Business Flow to RQM/ALM, " + resultInfo.ErrorDesc); return(false); } }
public async Task RemoveAsync(ActivityPlan activityPlan, long deleteUserId) { await activityPlan.RemoveAsync(_activityPlanRepository, deleteUserId); }
public void EditActivityPlan(ActivityPlan activityPlan, string name, ICollection <Tag> tags, long editUserId) { activityPlan.Edit(name, tags, editUserId); }
public IEnumerable <ActivityPlan> Put([FromBody] ActivityPlan activityPlan) { activityPlanRepo.Update(activityPlan); return(activityPlanRepo.GetAll()); }
public ActivityPlanWindow(ActivityPlan activityPlan) { InitializeComponent(); _viewModel = new ActivityPlanViewModel(activityPlan); }
public async Task <ActivityPlan> CreateAsync(ActivityPlan activityPlan) { activityPlan.Id = await _activityPlanRepository.InsertAndGetIdAsync(activityPlan); return(activityPlan); }
public bool ExportBfActivitiesGroupsToALM(BusinessFlow businessFlow, ObservableList <ActivitiesGroup> grdActivitiesGroups, ref string result) { LoginDTO loginData = new LoginDTO() { User = ALMCore.DefaultAlmConfig.ALMUserName, Password = ALMCore.DefaultAlmConfig.ALMPassword, Server = ALMCore.DefaultAlmConfig.ALMServerURL }; //ActivityPlan is TestPlan in RQM and BusinessFlow in Ginger List <IActivityPlan> testPlanList = new List <IActivityPlan>(); //1 ActivityPlan testPlan = new ActivityPlan(); testPlan.IsPlanDisabled = true; testPlanList.Add(testPlan); try { //Create (RQM)TestCase for each Ginger ActivityGroup and add it to RQM TestCase List testPlan.Activities = new List <IActivityModel>();//3 foreach (ActivitiesGroup ag in grdActivitiesGroups) { testPlan.Activities.Add(GetTestCaseFromActivityGroup(ag)); } RQMConnect.Instance.RQMRep.GetConection(); ResultInfo resultInfo; resultInfo = RQMConnect.Instance.RQMRep.ExportTestPlan(loginData, testPlanList, ALMCore.DefaultAlmConfig.ALMServerURL, RQMCore.ALMProjectGuid, ALMCore.DefaultAlmConfig.ALMProjectName, RQMCore.ALMProjectGroupName, null); // Deal with response from RQM after export // 0 = sucsess , 1 = failed if (resultInfo.ErrorCode == 0) { foreach (ActivityPlan plan in testPlanList) { int ActivityGroupCounter = 0; int activityStepCounter = 0; int activityStepOrderID = 0; foreach (ACL_Data_Contract.Activity act in plan.Activities) { string ActivityGroupID = "RQMID=" + act.ExportedID.ToString() + "|RQMScriptID=" + act.ExportedTestScriptId.ToString() + "|RQMRecordID=" + act.ExportedTcExecutionRecId.ToString() + "|AtsID=" + act.EntityId.ToString(); businessFlow.ActivitiesGroups[ActivityGroupCounter].ExternalID = ActivityGroupID; foreach (ACL_Data_Contract.ActivityStep activityStep in act.ActivityData.ActivityStepsColl) { string activityStepID = "RQMID=" + activityStepOrderID.ToString() + "|AtsID=" + act.EntityId.ToString(); businessFlow.Activities[activityStepCounter].ExternalID = activityStepID; activityStepCounter++; activityStepOrderID++; } activityStepOrderID = 0; ActivityGroupCounter++; } } } } catch (Exception ex) { result = "Failed to export the " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " to RQM/ALM " + ex.Message; Reporter.ToLog(eLogLevel.ERROR, "Failed to export " + GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroups) + " to RQM/ALM", ex); return(false); } return(true); }