public override DotnetStyleQualificationForMethodStyle Add(DotnetStyleQualificationForMethodStyle style) { if (style is null) { throw new ArgumentNullException(nameof(style)); } return(new DotnetStyleQualificationForMethodStyle(this.Data.Add(style.Data), this.Severity)); }
public static void CreateWithNoData() { var data = new BooleanData(); var style = new DotnetStyleQualificationForMethodStyle(data); Assert.That(style.Data, Is.SameAs(data), nameof(style.Data)); Assert.That(style.GetSetting(), Is.EqualTo(string.Empty), nameof(style.GetSetting)); }
public static void CreateWithCustomSeverity() { const Severity suggestion = Severity.Suggestion; var data = new BooleanData(); var style = new DotnetStyleQualificationForMethodStyle(data, suggestion); Assert.That(style.Severity, Is.EqualTo(suggestion), nameof(style.Data)); }
public static void CreateWithMoreTrueData() { var data = new BooleanData(1u, 1u, 0u); var style = new DotnetStyleQualificationForMethodStyle(data); Assert.That(style.Data, Is.SameAs(data), nameof(style.Data)); Assert.That(style.GetSetting(), Is.EqualTo( $"{DotnetStyleQualificationForMethodStyle.Setting} = true:{style.Severity.GetDescription()}"), nameof(style.GetSetting)); }
public static void Add() { var style1 = new DotnetStyleQualificationForMethodStyle(new BooleanData(3u, 1u, 2u)); var style2 = new DotnetStyleQualificationForMethodStyle(new BooleanData(30u, 10u, 20u)); var style3 = style1.Add(style2); var data = style3.Data; Assert.That(data.TotalOccurences, Is.EqualTo(33u), nameof(data.TotalOccurences)); Assert.That(data.TrueOccurences, Is.EqualTo(11u), nameof(data.TrueOccurences)); Assert.That(data.FalseOccurences, Is.EqualTo(22u), nameof(data.FalseOccurences)); }
public static void AddWithNull() { var style = new DotnetStyleQualificationForMethodStyle(new BooleanData()); Assert.That(() => style.Add(null !), Throws.TypeOf <ArgumentNullException>()); }