• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JaCraig / Mirage / 26317076325

22 May 2026 11:36PM UTC coverage: 86.964% (-0.8%) from 87.789%
26317076325

push

github

web-flow
Merge pull request #431 from JaCraig/dependabot/nuget/Mirage.Tests/dependencies-a1e413ef75

chore: Bump the dependencies group with 4 updates

493 of 860 branches covered (57.33%)

Branch coverage included in aggregate %.

3830 of 4111 relevant lines covered (93.16%)

140917.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

63.64
/Mirage/Generators/Default/Nullable/NullableUIntGenerator.cs
1
/*
2
Copyright 2017 James Craig
3

4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7

8
    http://www.apache.org/licenses/LICENSE-2.0
9

10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16

17
using Mirage.Generators.BaseClasses;
18
using Mirage.Interfaces;
19
using System;
20
using System.Collections.Generic;
21

22
namespace Mirage.Generators.Default.Nullable
23
{
24
    /// <summary>
25
    /// UInt generator
26
    /// </summary>
27
    /// <seealso cref="GeneratorAttributeBase"/>
28
    public sealed class NullableUIntGeneratorAttribute : GeneratorAttributeBase, IGenerator<uint?>
29
    {
30
        /// <summary>
31
        /// Initializes a new instance of the <see cref="NullableUIntGeneratorAttribute"/> class.
32
        /// </summary>
33
        /// <param name="min">The minimum.</param>
34
        /// <param name="max">The maximum.</param>
35
        public NullableUIntGeneratorAttribute(uint min, uint max)
36
            : base(min == 0 && max == 0 ? uint.MinValue : min, min == 0 && max == 0 ? uint.MaxValue : max)
5!
37
        {
38
        }
5✔
39

40
        /// <summary>
41
        /// Initializes a new instance of the <see cref="NullableUIntGeneratorAttribute"/> class.
42
        /// </summary>
43
        public NullableUIntGeneratorAttribute()
44
            : this(uint.MinValue, uint.MaxValue)
5✔
45
        {
46
        }
5✔
47

48
        /// <summary>
49
        /// Gets a value indicating whether this <see cref="IGenerator"/> is a default one.
50
        /// </summary>
51
        /// <value><c>true</c> if default; otherwise, <c>false</c>.</value>
52
        public override bool Default => true;
2✔
53

54
        /// <summary>
55
        /// Gets the type generated.
56
        /// </summary>
57
        /// <value>The type generated.</value>
58
        public override Type TypeGenerated => typeof(uint?);
3✔
59

60
        /// <summary>
61
        /// Generates a random value of the specified type
62
        /// </summary>
63
        /// <param name="rand">Random number generator that it can use</param>
64
        /// <returns>A randomly generated object of the specified type</returns>
65
        public uint? Next(Random rand)
66
        {
67
            return !(rand?.Next<bool>() ?? false) ? null : (uint?)rand.Next<uint>();
140✔
68
        }
69

70
        /// <summary>
71
        /// Generates a random value of the specified type
72
        /// </summary>
73
        /// <param name="rand">Random number generator that it can use</param>
74
        /// <param name="min">Minimum value (inclusive)</param>
75
        /// <param name="max">Maximum value (inclusive)</param>
76
        /// <returns>A randomly generated object of the specified type</returns>
77
        public uint? Next(Random rand, uint? min, uint? max)
78
        {
79
            if (!(rand?.Next<bool>() ?? false))
2!
80
                return null;
2✔
81
            min ??= uint.MinValue;
×
82
            max ??= uint.MaxValue;
×
83
            return rand.Next(min.Value, max.Value);
×
84
        }
85

86
        /// <summary>
87
        /// Generates next object
88
        /// </summary>
89
        /// <param name="rand">The rand.</param>
90
        /// <param name="previouslySeen">The previously seen.</param>
91
        /// <returns>The next object</returns>
92
        public override object? NextObj(Random rand, List<object> previouslySeen)
93
        {
94
            return Next(rand);
32✔
95
        }
96
    }
97
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc