public NoDuplicateComponentsViolation(ViolationLevel level, GameObject o, string c, int n) { this.Level = level; this.gameObject = o; this.componentName = c; this.count = n; }
public Violation( ICheckResult checkResult, IDocument document, object obj, ViolationLevel level = ViolationLevel.Error, Dictionary <string, object> data = null) { CheckResult = checkResult; Document = document; Object = obj; Level = level; Data.Add("Документ", Document); if (Document != Object) { Data.Add("Область исследования", Object); } if (data != null) { foreach (var dataItem in data) { Data.Add(dataItem); } } }
public NoInactiveBehaviours( ViolationLevel level = ViolationLevel.Warning, ViolationScope scope = ViolationScope.Both, List <Type> excludedTypes = null) : base(level, scope) { this.excludedTypes = excludedTypes ?? new List <Type>(); }
protected void AssertInvalidProperty(string code, string context, ViolationLevel level) { Assert.AreEqual(1, Violations.Count); Assert.AreEqual(code, Violations[0].Code); Assert.AreEqual(context, Violations[0].Context); Assert.AreEqual(level, Violations[0].ViolationLevel); }
private Rule ConstructRule(Type ruleClass, ViolationLevel level, ViolationScope scope, List <Type> excludedTypes) { if (excludedTypes == null || excludedTypes.Count == 0) { ConstructorInfo ctor = ruleClass.GetConstructor(new[] { typeof(ViolationLevel), typeof(ViolationScope) }); return((Rule)ctor.Invoke(new object[] { level, scope })); } else { ConstructorInfo ctor = ruleClass.GetConstructor(new[] { typeof(ViolationLevel), typeof(ViolationScope), typeof(List <Type>) }); if (ctor == null) { Log.Debug("Could not find constructor for " + ruleClass + " that takes list of excluded types. Using default constructor."); ctor = ruleClass.GetConstructor(new[] { typeof(ViolationLevel), typeof(ViolationScope) }); return((Rule)ctor.Invoke(new object[] { level, scope })); } return((Rule)ctor.Invoke(new object[] { level, scope, excludedTypes })); } }
// Helper method to add a violation with no calls. public void AddViolation(ViolationLevel level, String description) { Violation v = new Violation(); v.m_level = level; v.m_endpoint = Endpoint; v.m_summary = description; Violations.Add(v); }
// Helper method to add a violation with a single call public void AddViolation(ViolationLevel level, String description, ServiceCallItem call) { Violation v = new Violation(); v.m_level = level; v.m_endpoint = Endpoint; v.m_summary = description; v.m_violatingCalls.Add(call); Violations.Add(v); }
// Helper method to add a violation with a list of calls to the list. public void AddViolation(ViolationLevel level, String description, IEnumerable <ServiceCallItem> calls) { Violation v = new Violation(); v.m_level = level; v.m_endpoint = Endpoint; v.m_summary = description; v.m_violatingCalls.AddRange(calls); Violations.Add(v); }
private long AddViolationLevel(ViolationLevel level) { var seqId = NewSequence("ViolationLevel"); new SQLiteCommand("INSERT INTO ViolationLevel (Id, Name) VALUES (@Id, @Name)", _connection) { Parameters = { new SQLiteParameter("@Id", seqId), new SQLiteParameter("@Name", $"{level}") } }.ExecuteNonQuery(); return(seqId); }
public NoImageWithMissingSprite( ViolationLevel level = ViolationLevel.Warning, ViolationScope scope = ViolationScope.Both) : base(level, scope) { }
protected void AssertInvalidProperty(string s, ViolationLevel level) { var result = SwaggerValidator.Validate(Swagger); Assert.AreEqual(1, result.Count); Assert.AreEqual(s, result[0].Code); Assert.AreEqual(level, result[0].ViolationLevel); }
/// <summary> /// Validates a required property. /// </summary> /// <param name="value"></param> /// <param name="context"></param> /// <param name="level"></param> /// <param name="description"></param> /// <param name="result"></param> public static void ValidateRequiredProperty(string value, string context, ViolationLevel level, string description, ViolationCollection result) { var valid = value != null; if (!valid) result.Add(new Violation() { Code = context, ViolationLevel = level, Context = context, Description = description }); }
/// <summary> /// Validate a Url that is NOT required. /// </summary> /// <param name="value"></param> /// <param name="context"></param> /// <param name="level"></param> /// <param name="description"></param> /// <param name="result"></param> public static void ValidateRequiredUrl(string value, string context, ViolationLevel level, string description, ViolationCollection result) { try { if (value == null || value == "") { result.Add(new Violation() { Code = context, ViolationLevel = level, Context = context, Description = description }); } else { Uri uri = new Uri(value); } // If we get to here, the uri is valid. } catch { result.Add(new Violation() { Code = context, ViolationLevel = level, Context = context, Description = description }); } }
bool FailOrIgnore(ViolationLevel level) { if(level != ViolationLevel.Information && Strict) return true; return level == ViolationLevel.Critical || level == ViolationLevel.Error; }
/// <summary> /// Validate a Url that is NOT required. /// </summary> /// <param name="value"></param> /// <param name="context"></param> /// <param name="level"></param> /// <param name="description"></param> /// <param name="result"></param> public static void ValidateNotRequiredUrl(string value, string context, ViolationLevel level, string description, ViolationCollection result) { if (value != null) { var urlValid = false; try { Uri uri = new Uri(value); urlValid = true; } catch { } if (!urlValid) result.Add(new Violation() { Code = context, ViolationLevel = level, Context = context, Description = description }); } }
public Violation(ViolationLevel level,object source, string message) { Level = level; Message = message; Source = source; }
protected Rule(ViolationLevel level, ViolationScope scope) { this.Level = level; this.Scope = scope; }
public NoMissingObjectReferences( ViolationLevel level = ViolationLevel.Warning, ViolationScope scope = ViolationScope.Both) : base(level, scope) { }
private long?GetViolationLevelId(ViolationLevel level) => (long?)new SQLiteCommand($"SELECT Id FROM ViolationLevel WHERE Name = '{level}'", _connection).ExecuteScalar();
public Violation(ViolationLevel level, object source, string message) { Level = level; Message = message; Source = source; }
public NoImageWithMissingSpriteViolation(ViolationLevel level, Image image) { this.Level = level; this.image = image; }
public NoInactiveBehavioursViolation(ViolationLevel level, Component c) { this.Level = level; this.component = c; }
// Count the number of violations at the specified level public Int32 CountViolationLevel(ViolationLevel level) { return(Violations.Count(v => v.m_level == level)); }
public ConsoleViolation(ViolationLevel level, IViolation violation) { this.Level = level; this.Violation = violation; }
public NoMissingComponents( ViolationLevel level = ViolationLevel.Error, ViolationScope scope = ViolationScope.Both) : base(level, scope) { }
public NoMissingComponentsViolation(ViolationLevel level, GameObject o) { this.Level = level; this.gameObject = o; }
public NoDuplicateComponents( ViolationLevel level = ViolationLevel.Warning, ViolationScope scope = ViolationScope.Both) : base(level, scope) { }
public NoMissingObjectReferencesViolation(ViolationLevel level, Component c, string n) { this.component = c; this.Level = level; this.fieldName = n; }