public FileCheckWindow(CampaignValidator validator) { MinimumSize = new Size(600, 400); messagesView = new GridView() { GridLines = GridLines.Horizontal, ShowHeader = true, DataStore = validator?.Messages.Cast <object>(), Columns = { new GridColumn() { HeaderText = "Severity", Editable = false, Sortable = true, Resizable = false, Width = 96, DataCell = new ImageTextCell() { TextBinding = Binding.Property <ValidationItem, string>(message => $"{message.status.ToString().ToUpper()}"), ImageBinding = Binding.Property <ValidationItem, Image>(message => STATUS_IMAGES[message.status]()), ImageInterpolation = ImageInterpolation.High, VerticalAlignment = VerticalAlignment.Center //TextAlignment = TextAlignment.Right BRUH } }, new GridColumn() { HeaderText = "Message", Editable = false, Sortable = true, Resizable = true, Width = 512, DataCell = new TextBoxCell() { Binding = Binding.Property <ValidationItem, string>(message => $"{message.details}") } } } }; Content = new StackLayout() { Style = "vertical", Spacing = 8, Items = { new StackLayoutItem(messagesView, true), new StackLayoutItem(status = new Label(),false) } }; status.Text = $"Campaign validation: {validator.GetMessages(StatusLevel.Error).Length} Error(s) | {validator.GetMessages(StatusLevel.Warning).Length} Warning(s) | {validator.GetMessages(StatusLevel.Info).Length} Information(s) | {validator.Messages.Count} Total message(s)"; }
protected override void OnExecuted(EventArgs e) { CampaignValidator validator = new CampaignValidator(editor.CurrentFile.Directory); validator.Validate(editor.Document); new FileCheckWindow(validator) { Title = "Project file structure checker" }.Show(); }
public void CampaignValidatorInValidLeadTest() { // Add one controller for constraint met - return false List <IValidator> controllerList = new List <IValidator> { _testInvalidLeadValidator }; var controller = new CampaignValidator(controllerList, _campaignServiceProvider.GetService <ILoggerClient>()); var actualValidLead = controller.ValidLead(_testLeadEntity); Assert.AreEqual(false, actualValidLead); }
public void CampaignValidatorWithExceptionTest() { // Add one controller that will throw a not implemented exception List <IValidator> controllerList = new List <IValidator> { _testValidatorWithException }; try { var controller = new CampaignValidator(controllerList, _campaignServiceProvider.GetService <ILoggerClient>()); } catch (Exception ex) { Assert.AreEqual(typeof(NotImplementedException), ex.GetType()); } }
protected override async void OnExecuted(EventArgs e) { CampaignValidator validator = new CampaignValidator(editor.CurrentFile.Directory); validator.Validate(editor.Document); if (validator.GetMessages(StatusLevel.Error).Length > 0) { new FileCheckWindow(validator) { Title = DIALOG_CAPTION_EXPORT_CANCELED }.Show(); } else if (dialog.ShowDialog(owner) == DialogResult.Ok) { ExportProjectTask task = new ExportProjectTask(editor, new FileInfo(dialog.FileName)); ProgressWindow progressWindow = new ProgressWindow(owner); await TaskBase.Run(progressWindow, task).ConfigureAwait(false); } }
static ValidationFactory() { _typeValidators = new Dictionary <Type, object>(); _typeValidators[typeof(Campaign)] = new CampaignValidator(); }