public async void TestForCreatePlaybook() { var options = new DbContextOptionsBuilder <PlaybookContext>() .UseInMemoryDatabase(databaseName: "p3PlaybookService") .Options; using (var context = new PlaybookContext(options)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); Repo r = new Repo(context, new NullLogger <Repo>()); Mapper mapper = new Mapper(); Logic logic = new Logic(r, mapper, new NullLogger <Repo>()); var playbook = new Playbook { TeamID = Guid.NewGuid(), Name = "myplaybook" }; var createPlaybook = await logic.CreatePlaybook(playbook.TeamID, playbook.Name); //Assert.Equal(1, context.Playbooks.CountAsync().Result); Assert.Contains <Playbook>(createPlaybook, context.Playbooks); } }
// To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { LoginUser = _sessionService.GetLoginUser(HttpContext); if (LoginUser == null) { return(RedirectToPage("/Login")); } if (!ModelState.IsValid) { return(Page()); } try { Playbook = _playbookService.Find(PlaybookData.PlaybookSystemId); var updateUser = LoginUser; Playbook.ChangePlaybook(PlaybookData, PlayDesignFile, updateUser); _playbookService.Edit(Playbook); } catch (Exception ex) { Message = ex.Message; return(Page()); } return(RedirectToPage("./Index")); }
public ItemPlayData(PointF position, Playbook.DataModel.PlayViewType viewType) { ItemLocation = position; ViewType = viewType; ItemProperties = new Dictionary<string, string>(); }
public async void TestForGetPlaybooksByTeamId() { var options = new DbContextOptionsBuilder <PlaybookContext>() .UseInMemoryDatabase(databaseName: "p3PlaybookService") .Options; using (var context = new PlaybookContext(options)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); Repo r = new Repo(context, new NullLogger <Repo>()); Mapper mapper = new Mapper(); Logic logic = new Logic(r, mapper, new NullLogger <Repo>()); var playbook = new Playbook { Playbookid = Guid.NewGuid(), TeamID = Guid.NewGuid(), Name = "myplaybook", InDev = true }; r.Playbooks.Add(playbook); await r.CommitSave(); var listOfPlaybooks = await logic.GetPlaybooksByTeamId(playbook.TeamID); var castedList = (List <Playbook>)listOfPlaybooks; Assert.True(castedList[0].Equals(playbook)); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); if (GUILayout.Button("Play")) { Playbook pb = target as Playbook; pb.Play(); } }
public void CheckVersion() { var sb = new StringBuilder(); var playbook = new Playbook("test").Version(); playbook.Execute(x => sb.AppendLine(x)); Assert.That(sb.ToString(), Does.Contain("ansible-playbook")); }
/// <summary> /// Delete a Playbook by ID /// </summary> /// <param name="id">PlaybookID</param> /// <returns>deleted Playbook</returns> public async Task <Playbook> DeletePlaybook(Guid id) { Playbook playbook = await GetPlaybookById(id); if (playbook != null) { _repo.Playbooks.Remove(playbook); await _repo.CommitSave(); } return(playbook); }
private void OnProcessInvoked(Playbook playbook, TrackedProcessInvocation process) { var item = new ListViewItem(process.InstanceUID.ToString("D", CultureInfo.InvariantCulture) + (process.InvocationCounter > 1 ? "/" + process.InvocationCounter.ToString("D", CultureInfo.InvariantCulture) : "")) { Tag = process, }; item.SubItems.Add("-"); item.SubItems.Add(process.Topic); item.SubItems.Add(process.IdentedName); item.SubItems.Add(process.KindToString()); item.SubItems.Add(process.Type); item.SubItems.Add("0"); item.SubItems.Add("0"); item.SubItems.Add("0"); item.SubItems.Add("0"); item.SubItems.Add("0"); item.SubItems.Add("0").Tag = new Func <string>(() => process.GetFormattedRowFlow(Context)); item.Tag = process; if (ListView.SelectedItems.Count == 0) { item.Selected = true; } if (process.Invoker != null && _itemsByProcessInvocationUid.TryGetValue(process.Invoker.InvocationUid, out var invokerItem)) { var nextIndex = invokerItem.Index + 1; while (nextIndex < _allItems.Count) { var p = _allItems[nextIndex].Tag as TrackedProcessInvocation; if (!p.HasParent(process.Invoker)) { break; } nextIndex++; } _allItems.Insert(nextIndex, item); ListView.Items.Insert(nextIndex, item); } else { _allItems.Add(item); ListView.Items.Add(item); } _itemsByProcessInvocationUid.Add(process.InvocationUid, item); }
public void CheckOutput() { var sb = new StringBuilder(); var playbook = new Playbook("../../../../playbooks/environment.yml"); playbook.Execute(x => sb.AppendLine(x)); var t = sb.ToString(); Assert.Pass(); }
/// <summary> /// Create new Playbook and assign it to a team /// </summary> /// <param name="teamId">TeamID</param> /// <returns>Playbook</returns> public async Task <Playbook> CreatePlaybook(Guid teamId, string name) { Playbook newPlayBook = new Playbook() { TeamID = teamId, Name = name }; await _repo.Playbooks.AddAsync(newPlayBook); await _repo.CommitSave(); return(newPlayBook); }
public void ValidatePlaybook() { var playbook = new Playbook() { Playbookid = Guid.NewGuid(), TeamID = Guid.NewGuid(), Name = "myplaybook", InDev = true }; var results = ValidateModel(playbook); Assert.True(results.Count == 0); }
public Playbook ToModel() { Playbook playbook = new Playbook(PlaybookSystemId); playbook.ChangePlaybookId(PlaybookId); playbook.ChangeCategory(CategoryData != null ? CategoryData.ToModel() : new Models.Category("0000")); playbook.ChangePlayName(new PlayName(PlayFullName, PlayShortName, PlayCallName)); playbook.ChangeContext(new Context(Context)); playbook.ChangeInstallStatus(IntroduceStatus); playbook.ChangePlayDesign(new PlayDesign(PlayDesignUrl)); playbook.ChangeCreateUser(CreateUserData != null ? CreateUserData.ToModel() : new User(0, 0), CreateDate); playbook.ChangeLastUpdateUser(LastUpdateUserData != null ? LastUpdateUserData.ToModel() : new User(0, 0), LastUpdateDate); return(playbook); }
private async Task <Playbook> CreateOrUpdatePlaybook(Playbook playbook) { CreatePlaybooks createPlaybooks = new CreatePlaybooks(_props); Playbook res = await createPlaybooks.CreatePlaybookInTfs(playbook); if (!_dictionary.ContainsKey(playbook.PlaybookName)) { res = await createPlaybooks.CreatePlaybookInTfs(playbook); } else { res.PlaybookName = playbook.PlaybookName; res.PlaybookId = _dictionary[playbook.PlaybookName]; } return(res); }
public Playbook GetPlaybookForWeekShift(int weekShift) { var week = _calendar.GetStartOfWeekItemByShift(weekShift); var data = _repository.Query(a => a.WhenID == week.ID).ToList(); var rows = data.Select(row => _mapper.Map <PlaybookRow>(row)).ToList(); var result = new Playbook { WeekID = week.ID, WeekNo = week.WeekNo }; result.Rows.AddRange(rows); return(result); }
public async Task <Playbook> CreatePlaybookInTfs(Playbook playbook) { Playbook res = new Playbook(); List <Object> patchDocument = new List <object>(); patchDocument.Add(new { op = "add", path = "/fields/System.Title", value = playbook.PlaybookName }); //serialize the fields array into a json string var patchValue = new StringContent(JsonConvert.SerializeObject(patchDocument), Encoding.UTF8, "application/json-patch+json"); var requestUri = "APHP/" + _project + "/_apis/wit/workitems/$Playbook?api-version=3.0"; var method = new HttpMethod("PATCH"); var request = new HttpRequestMessage(method, requestUri) { Content = patchValue }; string requestTxt = await request.Content.ReadAsStringAsync(); var response = await _client.SendAsync(request); _logger.LogUriAndPackage(requestUri, requestTxt); string responseTxt = await response.Content.ReadAsStringAsync(); _logger.Log(responseTxt); if (response.IsSuccessStatusCode) { string workItem = await response.Content.ReadAsStringAsync(); JObject jo = JObject.Parse(workItem); res.PlaybookId = Convert.ToInt32(jo["id"]); res.PlaybookName = playbook.PlaybookName; return(res); } else { return(null); } }
public async void TestForDeletePlaybook() { var options = new DbContextOptionsBuilder <PlaybookContext>() .UseInMemoryDatabase(databaseName: "p3PlaybookService") .Options; using (var context = new PlaybookContext(options)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); Repo r = new Repo(context, new NullLogger <Repo>()); Mapper mapper = new Mapper(); Logic logic = new Logic(r, mapper, new NullLogger <Repo>()); var playbook = new Playbook() { Playbookid = Guid.NewGuid(), TeamID = Guid.NewGuid(), Name = "myplaybook", InDev = true }; r.Playbooks.Add(playbook); await r.CommitSave(); var deleteEmpty = await logic.DeletePlaybook(Guid.NewGuid()); Assert.Contains <Playbook>(playbook, context.Playbooks); var deletePlaybook = await logic.DeletePlaybook(playbook.Playbookid); var countPlaybooks = from p in context.Playbooks where p.Playbookid == playbook.Playbookid select p; int count = 0; foreach (Playbook playbooks in countPlaybooks) { count++; } Assert.Equal(0, count); } }
private void OnEventsAdded(Playbook playbook, List <AbstractEvent> abstractEvents) { var events = abstractEvents.OfType <LogEvent>().ToList(); if (events.Count == 0) { return; } foreach (var evt in events) { var text = evt.Text; if (evt.Arguments != null) { foreach (var arg in evt.Arguments) { text = arg.Key.StartsWith("{spacing", StringComparison.OrdinalIgnoreCase) ? text.Replace(arg.Key, "", StringComparison.InvariantCultureIgnoreCase) : text.Replace(arg.Key, FormattingHelpers.ToDisplayValue(arg.Value), StringComparison.InvariantCultureIgnoreCase); } } var item = new LogModel() { Timestamp = new DateTime(evt.Timestamp), Playbook = playbook, Event = evt, Process = evt.ProcessInvocationUID != null ? playbook.DiagContext.WholePlaybook.ProcessList[evt.ProcessInvocationUID.Value] : null, Text = text, }; _updater.AddItem(item); } }
public async Task <IActionResult> OnGetAsync(int?id) { LoginUser = _sessionService.GetLoginUser(HttpContext); if (LoginUser == null) { return(RedirectToPage("/Login")); } if (id == null) { return(NotFound()); } Playbook = _playbookService.Find((int)id); if (Playbook == null) { return(NotFound()); } PlaybookData = Playbook.ToData(); return(Page()); }
private void OnRowStoreStarted(Playbook playbook, TrackedStore store) { _updater.AddItem(store); }
private void OnSinkStarted(Playbook playbook, TrackedSink sink) { _updater.AddItem(sink); }
public PlayerPlayData(PointF position, Image sprite, float width, float height, int id, String name, Playbook.DataModel.Team team) : base(position, sprite, width, height, Playbook.DataModel.PlayViewType.Player) { base.ItemProperties.Add("id", id.ToString(CultureInfo.InvariantCulture)); base.ItemProperties.Add("team", team.UniqueId.ToString(CultureInfo.InvariantCulture)); base.ItemProperties.Add("name", name); }
public IActionResult AddPlaybook(Playbook playbook) { _service.AddPlaybook(playbook); return(Redirect("/")); }
private List <ContractRequirement> GatherRequirements(Excel.Worksheet worksheet) { List <ContractRequirement> res = new List <ContractRequirement>(); int usedRows = GetUsedRows(worksheet); List <int> existingRequirements = new List <int>(); using (var progress = new ProgressBar()) { Console.Write("Gathering Requirements... "); for (int i = 3; i <= usedRows; i++) { progress.Report((double)i / (double)usedRows); if (!existingRequirements.Contains(Convert.ToInt32(worksheet.Cells[i, 5].Value2.ToString()))) { ContractRequirement currContractRequirement = new ContractRequirement(); currContractRequirement.RequirementID = Convert.ToInt32(worksheet.Cells[i, 5].Value2.ToString()); currContractRequirement.RequirementTitle = worksheet.Cells[i, 6].Value2.ToString(); currContractRequirement.Description = worksheet.Cells[i, 7].Value2.ToString(); currContractRequirement.ProposedLanguage = worksheet.Cells[i, 8].Value2.ToString(); currContractRequirement.PrimaryArea = worksheet.Cells[i, 9].Value2.ToString(); currContractRequirement.State = worksheet.Cells[i, 10].Value2.ToString(); currContractRequirement.Validated = worksheet.Cells[i, 11].Value2.ToString(); if (worksheet.Cells[i, 12].Value2 != null) { currContractRequirement.DeScopeDetails = worksheet.Cells[i, 12].Value2.ToString(); } if (worksheet.Cells[i, 13].Value2 != null) { currContractRequirement.ValidationActionItem = worksheet.Cells[i, 13].Value2.ToString(); } if (worksheet.Cells[i, 14].Value2 != null) { currContractRequirement.ValidationActionItemStatus = worksheet.Cells[i, 14].Value2.ToString(); } if (worksheet.Cells[i, 15].Value2 != null) { currContractRequirement.ValidationAssumptions = worksheet.Cells[i, 15].Value2.ToString(); } if (worksheet.Cells[i, 16].Value2 != null) { currContractRequirement.Deliverable = worksheet.Cells[i, 16].Value2.ToString(); } if (worksheet.Cells[i, 17].Value2 != null) { currContractRequirement.CoveredInCrp = worksheet.Cells[i, 17].Value2.ToString(); } if (worksheet.Cells[i, 18].Value2 != null) { List <string> allCrpSession = ExtractNewLineValues(worksheet.Cells[i, 18].Value2.ToString()); currContractRequirement.CrpSession = new List <CrpSession>(); foreach (string crpSession in allCrpSession) { if (_crpSessionMapping.ContainsKey(crpSession)) { CrpSession currCrpSession = new CrpSession { CrpSessionId = _crpSessionMapping[crpSession], CrpSessionName = crpSession }; currContractRequirement.CrpSession.Add(currCrpSession); } } } if (worksheet.Cells[i, 19].Value2 != null) { currContractRequirement.SolutionUnderstanding = worksheet.Cells[i, 19].Value2.ToString(); } if (worksheet.Cells[i, 20].Value2 != null) { //Console.WriteLine(_opssWorksheet.Cells[i, 20].Value2); List <string> allPlaybooks = ExtractNewLineValues(worksheet.Cells[i, 20].Value2.ToString()); currContractRequirement.Playbooks = new List <Playbook>(); foreach (string playbook in allPlaybooks) { if (_playbookMapping.ContainsKey(playbook)) { Playbook currPlaybook = new Playbook { PlaybookId = _playbookMapping[playbook], PlaybookName = playbook }; currContractRequirement.Playbooks.Add(currPlaybook); } } } if (worksheet.Cells[i, 21].Value2 != null) { List <string> allWorkPackages = ExtractNewLineValues(worksheet.Cells[i, 21].Value2.ToString()); currContractRequirement.WorkPackages = new List <WorkPackage>(); foreach (string workPackage in allWorkPackages) { WorkPackage currWorkPackage = new WorkPackage { WorkPackageName = workPackage }; currContractRequirement.WorkPackages.Add(currWorkPackage); } } if (worksheet.Cells[i, 22].Value2 != null) { List <string> allProductDsd = ExtractNewLineValues(worksheet.Cells[i, 22].Value2.ToString()); currContractRequirement.ProductDSD = new List <ProductDsd>(); foreach (string productDsd in allProductDsd) { if (_productDsdMapping.ContainsKey(productDsd)) { ProductDsd currProductDsd = new ProductDsd { ProductDsdId = _productDsdMapping[productDsd], ProductDsdName = productDsd }; currContractRequirement.ProductDSD.Add(currProductDsd); } } } if (worksheet.Cells[i, 24].Value2 != null) { currContractRequirement.VendorIntegration = worksheet.Cells[i, 24].Value2.ToString(); } if (worksheet.Cells[i, 25].Value2 != null) { currContractRequirement.Coverage = worksheet.Cells[i, 25].Value2.ToString(); } existingRequirements.Add(currContractRequirement.RequirementID); res.Add(currContractRequirement); } } Console.WriteLine(); } return(res); }
void lExp2_Click(object sender, RoutedEventArgs e) { Button b = (Button)sender; PlaybookTag pbt = (PlaybookTag)b.Tag; Playbook p = new Playbook(); p.OpenFromContract(pbt.id, pbt.html, pbt.type); p.Show(); }
private void btnPlaybookInfo_Click(object sender, RoutedEventArgs e) { if (this.CurrentClauseId != "") { DataRow clause = this.GetClauseRow(this.CurrentClauseId)[0]; string html = clause["Clause__r_Concept__r_PlayBookInfo__c"].ToString(); Playbook p = new Playbook(); p.Open(this,this.CurrentConceptId, html, "Info"); p.Show(); } }
public void AddPlaybook(Playbook block) { _playbookContext.Playbooks.Add(block); _playbookContext.SaveChanges(); }
public void AddPlaybook(Playbook playbook) { _service.AddPlaybook(playbook); }
public SpritePlayData(PointF position, Image sprite, float width, float height, Playbook.DataModel.PlayViewType viewType) : base(position, viewType) { mSprite = sprite; mWidth = width; mHeight = height; }