public static bool TryParse(string value, out Criticality result)
            {
                result = default(Criticality);

                if (value == "fatal")
                {
                    result = Criticality.Fatal;
                }
                else if (value == "high")
                {
                    result = Criticality.High;
                }
                else if (value == "medium")
                {
                    result = Criticality.Medium;
                }
                else if (value == "low")
                {
                    result = Criticality.Low;
                }
                else
                {
                    return(false);
                }

                return(true);
            }
Esempio n. 2
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="type">Type</param>
 /// <param name="lastModified">Last Modified</param>
 /// <param name="output">Plugin output</param>
 /// <param name="description">Description</param>
 /// <param name="criticality">Criticality</param>
 public Plugin(string name, string type, DateTime lastModified, string output, string description, Criticality criticality)
 {
     Name         = name;
     Type         = type;
     Output       = output;
     LastModified = lastModified;
     Criticality  = criticality;
     Description  = description;
 }
        public override ICollection <byte> SerializeControl()
        {
            var content      = new List <byte>();
            var controlValue = ControlValue.Serialize();
            var serialized   = new DEROctetString
            {
                Payload = controlValue.ToList()
            };

            content.AddRange(ControlType.Serialize());
            content.AddRange(Criticality.Serialize());
            content.AddRange(serialized.Serialize());

            Length = content.Count;
            var result = new List <byte>();

            result.AddRange(SerializeDerStructure());
            result.AddRange(content);

            return(result);
        }
 public static string ToString(Criticality value)
 {
     if (value == Criticality.Fatal)
     {
         return("fatal");
     }
     else if (value == Criticality.High)
     {
         return("high");
     }
     else if (value == Criticality.Medium)
     {
         return("medium");
     }
     else if (value == Criticality.Low)
     {
         return("low");
     }
     else
     {
         throw new ArgumentException("Unrecognized Criticality value: " + value.ToString());
     }
 }
        private static void VerfiyChanges(Result result, Type typeOfChange, string path, Criticality criticality, string message)
        {
            Assert.AreEqual(1, result.changes.Count);
            Change change = result.changes[0];

            Assert.AreEqual(path, change.Path, "Path is not as expected");
            Assert.AreEqual(typeOfChange, result.changes[0].GetType(), "The change type is not as expected");
            Assert.AreEqual(criticality == Criticality.Breaking, change.IsBreaking, "Isbreaking was not as expected");
            Assert.AreEqual(criticality == Criticality.Dangerous, change.IsDangerous, "IsDangerous was not as expected");
            Assert.AreEqual(criticality == Criticality.NonBreaking, change.IsNonBreaking, "IsNoneBreaking was not as expected");
            Assert.AreEqual(message, change.Message);
        }
Esempio n. 6
0
 public StatusMessage(Criticality criticality, string messageText)
 {
     Criticality = criticality;
     Message     = messageText;
 }
Esempio n. 7
0
 public StatusMessage(Criticality criticality, string messageText)
 {
     Criticality = criticality;
     Message = messageText;
 }
Esempio n. 8
0
 internal Change(Criticality criticality)
 {
     this.criticality = criticality;
 }
            public static bool TryParse(string value, out Criticality result)
            {
                result = default(Criticality);

                if( value=="fatal")
                    result = Criticality.Fatal;
                else if( value=="high")
                    result = Criticality.High;
                else if( value=="medium")
                    result = Criticality.Medium;
                else if( value=="low")
                    result = Criticality.Low;
                else
                    return false;

                return true;
            }
 public static string ToString(Criticality value)
 {
     if( value==Criticality.Fatal )
         return "fatal";
     else if( value==Criticality.High )
         return "high";
     else if( value==Criticality.Medium )
         return "medium";
     else if( value==Criticality.Low )
         return "low";
     else
         throw new ArgumentException("Unrecognized Criticality value: " + value.ToString());
 }