Example #1
0
        public static void CreateWithNoData()
        {
            var data  = new BooleanData();
            var style = new DotnetStyleQualificationForEventStyle(data);

            Assert.That(style.Data, Is.SameAs(data), nameof(style.Data));
            Assert.That(style.GetSetting(), Is.EqualTo(string.Empty), nameof(style.GetSetting));
        }
Example #2
0
        public static void CreateWithCustomSeverity()
        {
            const Severity suggestion = Severity.Suggestion;
            var            data       = new BooleanData();
            var            style      = new DotnetStyleQualificationForEventStyle(data, suggestion);

            Assert.That(style.Severity, Is.EqualTo(suggestion), nameof(style.Data));
        }
Example #3
0
 public override DotnetStyleQualificationForEventStyle Add(DotnetStyleQualificationForEventStyle style)
 {
     if (style is null)
     {
         throw new ArgumentNullException(nameof(style));
     }
     return(new DotnetStyleQualificationForEventStyle(this.Data.Add(style.Data), this.Severity));
 }
Example #4
0
        public static void CreateWithMoreTrueData()
        {
            var data  = new BooleanData(1u, 1u, 0u);
            var style = new DotnetStyleQualificationForEventStyle(data);

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

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