• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rwjdk / TrelloDotNet / 6040892211

31 Aug 2023 06:06PM UTC coverage: 69.675% (+0.1%) from 69.534%
6040892211

push

github

Rasmus Wulff Jensen
Automation Engine can now make automations with multiple triggers

836 of 1521 branches covered (0.0%)

Branch coverage included in aggregate %.

24 of 24 new or added lines in 2 files covered. (100.0%)

2105 of 2700 relevant lines covered (77.96%)

62.3 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.1
/TrelloDotNet/TrelloDotNet/AutomationEngine/Model/Automation.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Diagnostics;
4
using TrelloDotNet.AutomationEngine.Interface;
5

6
namespace TrelloDotNet.AutomationEngine.Model
7
{
8
    /// <summary>
9
    /// A representation of a Webhook Automation
10
    /// </summary>
11
    [DebuggerDisplay("{Name}")]
12
    public class Automation
13
    {
14
        /// <summary>
15
        /// Constructor
16
        /// </summary>
17
        /// <param name="name">Name of the Automation (as such not used for anything other than identification and error messages)</param>
18
        /// <param name="trigger">The Trigger of the automation (aka the first, light, initial condition of what you wish the automation to react to)</param>
19
        /// <param name="conditions">The additional conditions of the automation</param>
20
        /// <param name="actions">The action(s) that should be taken should trigger + all conditions be met</param>
21
        public Automation(string name, IAutomationTrigger trigger, List<IAutomationCondition> conditions, List<IAutomationAction> actions)
25✔
22
        {
23
            Name = name;
25✔
24
#pragma warning disable CS0618 // Type or member is obsolete
25
            Trigger = trigger ?? throw new ArgumentNullException(nameof(trigger), "Trigger can't be null");
25✔
26
#pragma warning restore CS0618 // Type or member is obsolete
27
            Triggers = new List<IAutomationTrigger> { trigger };
24✔
28
            Conditions = conditions;
24✔
29

30
            if (actions == null)
24✔
31
            {
32
                throw new ArgumentNullException(nameof(actions), "Actions can't be null");
1✔
33
            }
34

35
            if (actions.Count == 0)
23✔
36
            {
37
                throw new ArgumentException("You need at least one action", nameof(actions));
1✔
38
            }
39
            Actions = actions;
22✔
40
        }
22✔
41
        
42
        /// <summary>
43
        /// Constructor
44
        /// </summary>
45
        /// <param name="name">Name of the Automation (as such not used for anything other than identification and error messages)</param>
46
        /// <param name="triggers">A List of possible triggers of the automation (aka the first, light, initial condition of what you wish the automation to react to). These are evaluated as 'OR' (aka proceed if any of the triggers are met)</param>
47
        /// <param name="conditions">The additional conditions of the automation</param>
48
        /// <param name="actions">The action(s) that should be taken should trigger + all conditions be met</param>
49
        public Automation(string name, List<IAutomationTrigger> triggers, List<IAutomationCondition> conditions, List<IAutomationAction> actions)
8✔
50
        {
51
            Name = name;
8✔
52
            Triggers = triggers ?? throw new ArgumentNullException(nameof(triggers), "Trigger can't be null");
8✔
53
            if (triggers.Count == 0)
7✔
54
            {
55
                throw new ArgumentException("You need at least one Trigger", nameof(actions));
1✔
56
            }
57

58
            Conditions = conditions;
6✔
59

60
            if (actions == null)
6!
61
            {
62
                throw new ArgumentNullException(nameof(actions), "Actions can't be null");
×
63
            }
64

65
            if (actions.Count == 0)
6!
66
            {
67
                throw new ArgumentException("You need at least one action", nameof(actions));
×
68
            }
69
            Actions = actions;
6✔
70
        }
6✔
71

72
        /// <summary>
73
        /// Name of the Automation
74
        /// </summary>
75
        public string Name { get; }
26✔
76

77
        /// <summary>
78
        /// The Trigger of the automation (aka the first, light, initial condition of what you wish the automation to react to)
79
        /// </summary>
80
        [Obsolete("This property is Deprecated as system now support multiple Triggers in Automations. Please use Triggers.First() Instead")]
81
        public IAutomationTrigger Trigger { get; }
×
82
        
83
        /// <summary>
84
        /// A List of Triggers of the automation (aka the first, light, initial condition of what you wish the automation to react to). Will proceed if any of the triggers are met
85
        /// </summary>
86
        public List<IAutomationTrigger> Triggers { get; }
25✔
87

88
        /// <summary>
89
        /// The additional conditions of the automation
90
        /// </summary>
91
        public List<IAutomationCondition> Conditions { get; }
40✔
92

93
        /// <summary>
94
        /// The action(s) that should be taken should trigger + all conditions be met
95
        /// </summary>
96
        public List<IAutomationAction> Actions { get; }
30✔
97
    }
98
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc