Exemplo n.º 1
0
 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));
 }
Exemplo n.º 2
0
    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));
    }
Exemplo n.º 3
0
    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));
    }
Exemplo n.º 4
0
    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));
    }
Exemplo n.º 5
0
    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));
    }
Exemplo n.º 6
0
    public static void AddWithNull()
    {
        var style = new DotnetStyleQualificationForMethodStyle(new BooleanData());

        Assert.That(() => style.Add(null !), Throws.TypeOf <ArgumentNullException>());
    }