예제 #1
0
 public override CSharpSpaceBetweenMethodCallParameterListParenthesesStyle Add(CSharpSpaceBetweenMethodCallParameterListParenthesesStyle style)
 {
     if (style is null)
     {
         throw new ArgumentNullException(nameof(style));
     }
     return(new CSharpSpaceBetweenMethodCallParameterListParenthesesStyle(this.Data.Add(style.Data)));
 }
    public static void CreateWithNoData()
    {
        var data  = new BooleanData();
        var style = new CSharpSpaceBetweenMethodCallParameterListParenthesesStyle(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 CSharpSpaceBetweenMethodCallParameterListParenthesesStyle(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 CSharpSpaceBetweenMethodCallParameterListParenthesesStyle(data);

        Assert.That(style.Data, Is.SameAs(data), nameof(style.Data));
        Assert.That(style.GetSetting(), Is.EqualTo(
                        $"{CSharpSpaceBetweenMethodCallParameterListParenthesesStyle.Setting} = true:{style.Severity.GetDescription()}"), nameof(style.GetSetting));
    }
    public static void Add()
    {
        var style1 = new CSharpSpaceBetweenMethodCallParameterListParenthesesStyle(new BooleanData(3u, 1u, 2u));
        var style2 = new CSharpSpaceBetweenMethodCallParameterListParenthesesStyle(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 CSharpSpaceBetweenMethodCallParameterListParenthesesStyle(new BooleanData());

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