public async Task TemplateLogic_GetAllTemplates_Should_Return_Available_Templates() { // Arrange var templateRepository = new Mock <IRepository <Template> >(); var templateLogic = new TemplateLogic(templateRepository.Object, new TemplateMapper()); Template template1 = new Template { Id = Guid.NewGuid(), Name = "Template1", Script = "Script1" }; Template template2 = new Template { Id = Guid.NewGuid(), Name = "Template2", Script = "Script2" }; // Mock templateRepository.Setup(x => x.GetAll()).ReturnsAsync(new[] { template1, template2 }); // Act var result = await templateLogic.GetAllTemplates(); // Assert result.Should().HaveCount(2); result.Should().ContainEquivalentOf(template1, properties => properties .Including(p => p.Id) .Including(p => p.Name) .Including(p => p.Script)); result.Should().ContainEquivalentOf(template2, properties => properties .Including(p => p.Id) .Including(p => p.Name) .Including(p => p.Script)); }
private void PopulateGrid() { var logic = new TemplateLogic(GlobalData.AppInfo); _list = logic.SearchTemplates(new SearchTemplatesArgs()); templateBindingSource.DataSource = _list; dataGridView1.Columns[0].Visible = _mode == ManageTemplatesModes.Select; }
public void TemplateLogic_GetTemplateAndEnsureNotEmpty(string templateName) { // Act var template = TemplateLogic.GetTemplate(templateName); // Assert Assert.False(string.IsNullOrWhiteSpace(template)); }
public MailChimpManager(string apiKey) : base(apiKey) { Api = new ApiLogic(ApiKey); Apps = new AuthorizedAppLogic(ApiKey); AutomationEmails = new AutomationEmailLogic(ApiKey); AutomationEmailQueues = new AutomationEmailQueueLogic(ApiKey); Automations = new AutomationLogic(ApiKey); AutomationSubscribers = new AutomationSubscriberLogic(ApiKey); Campaigns = new CampaignLogic(ApiKey); Content = new ContentLogic(ApiKey); Conversations = new ConversationLogic(ApiKey); Feedback = new FeedBackLogic(ApiKey); Lists = new ListLogic(ApiKey); Members = new MemberLogic(ApiKey); Messages = new MessageLogic(ApiKey); Reports = new ReportLogic(ApiKey); TemplateFolders = new TemplateFolderLogic(ApiKey); Templates = new TemplateLogic(ApiKey); }
private void btnSave_Click(object sender, EventArgs e) { // make sure there is a name if (string.IsNullOrEmpty(txtName.Text)) { MessageBox.Show("Please provide a template group name"); return; } // make sure at least on template is in group if (_templateList.Count == 0) { MessageBox.Show("Please add at least on template"); return; } // convert the templates back into a templategroupmember var memList = _templateList.Select(a => new TemplateGroupMember() { TemplateId = a.TemplateId, TemplateGroupId = _group.TemplateGroupId }).ToList(); // get the new and deleted templates var diff = Helpers.GetListDiff <TemplateGroupMember>(_group.TemplateGroupMembers, memList, (a, b) => a.TemplateId == b.TemplateId); // add the new templates diff.NewEntries.ForEach(a => _group.TemplateGroupMembers.Add(a)); // add to the deleted list diff.DeletedEntries.ForEach(a => _group.DeletedMembers.Add(a)); // save the group var logic = new TemplateLogic(GlobalData.AppInfo); if (_group.TemplateGroupId > 0) { logic.UpdateTemplateGroup(_group); } else { logic.CreateTemplateGroup(_group); } this.DialogResult = DialogResult.OK; this.Close(); }
private bool Save() { _template.TemplateName = txtName.Text; _template.PathMask = txtPathMask.Text; _template.FileMask = txtFileMask.Text; _template.CodeProjectTypeCode = cboProjType.SelectedValue.ToString().Length > 0 ? cboProjType.SelectedValue.ToString() : null; _template.LanguageTypeCode = cboLanguage.SelectedValue.ToString().Length > 0 ? cboLanguage.SelectedValue.ToString() : null; _template.DeletedEntities = Helpers.SyncList(_template.TemplateEntityAttributes, _attrList, (to, from) => to.EntityAttributeTypeCode == from.EntityAttributeTypeCode); var logic = new TemplateLogic(GlobalData.AppInfo); if (_template.TemplateId == 0) { logic.CreateTemplate(_template); } else { logic.UpdateTemplate(_template); } return(true); }
public async Task TemplateLogic_GetAllTemplates_Should_Return_A_Number_Of_Fixed_Scripts_If_None_Are_Available() { // Arrange var templateRepository = new Mock <IRepository <Template> >(); var templateLogic = new TemplateLogic(templateRepository.Object, new TemplateMapper()); // Mock templateRepository.Setup(x => x.GetAll()).ReturnsAsync(new Template[] { }); // Act var result = await templateLogic.GetAllTemplates(); // Assert result.Should().HaveCount(BotScripts.All.Count); foreach (var script in BotScripts.All) { result.Should().ContainEquivalentOf(script, properties => properties .Including(p => p.Id) .Including(p => p.Name) .Including(p => p.Script)); } }
public MailChimpManager(IOptions <MailchimpOptions> optionsAccessor) : base(optionsAccessor) { var options = optionsAccessor.Value; Activities = new ActivityLogic(options); AbuseReports = new AbuseReportLogic(options); Api = new ApiLogic(options); Apps = new AuthorizedAppLogic(options); AutomationEmails = new AutomationEmailLogic(options); AutomationEmailQueues = new AutomationEmailQueueLogic(options); Automations = new AutomationLogic(options); AutomationSubscribers = new AutomationSubscriberLogic(options); Batches = new BatchLogic(options); Campaigns = new CampaignLogic(options); CampaignFolders = new CampaignFolderLogic(options); Clients = new ClientLogic(options); Content = new ContentLogic(options); Conversations = new ConversationLogic(options); ECommerceStores = new ECommerceLogic(options); Feedback = new FeedBackLogic(options); FileManagerFiles = new FileManagerFileLogic(options); FileManagerFolders = new FileManagerFolderLogic(options); GrowthHistories = new GrowthHistoryLogic(options); InterestCategories = new InterestCategoryLogic(options); Interests = new InterestLogic(options); Lists = new ListLogic(options); ListSegments = new ListSegmentLogic(options); Members = new MemberLogic(options); MergeFields = new MergeFieldLogic(options); Messages = new MessageLogic(options); Notes = new NoteLogic(options); Reports = new ReportLogic(options); TemplateFolders = new TemplateFolderLogic(options); Templates = new TemplateLogic(options); WebHooks = new WebHookLogic(options); }
public void Setup() { TemplateDalContainer = TemplateFactory.CreateTemplateDalContainer(); TemplateDalLogic = TemplateFactory.CreateTemplateDALLogic(); TemplateLogic = new TemplateLogic(); }