public void MustBeNonNegativeTest() { var testValue0 = 0; var testValue1 = 1; var exception0 = Record.Exception(() => Precondition.MustBeNonNegative(testValue0)); var exception1 = Record.Exception(() => Precondition.MustBeNonNegative(testValue1)); Assert.Null(exception0); Assert.Null(exception1); }
/// <summary> /// Initializes a new instance of the <see cref="Biome"/> class. /// </summary> /// <param name="in_id">Unique identifier for the <see cref="Biome"/>. Cannot be null.</param> /// <param name="in_name">Player-friendly name of the <see cref="Biome"/>. Cannot be null or empty.</param> /// <param name="in_description">Player-friendly description of the <see cref="Biome"/>.</param> /// <param name="in_comment">Comment of, on, or by the <see cref="Biome"/>.</param> /// <param name="in_tier">A rating indicating where in the progression this <see cref="Biome"/> falls.</param> /// <param name="in_elevationCategory">Describes where this <see cref="Biome"/> falls in terms of the game world's overall topography.</param> /// <param name="in_isLiquidBased">Determines whether or not this <see cref="Biome"/> is defined in terms of liquid parquets.</param> /// <param name="in_parquetCriteria">Describes the parquets that make up this <see cref="Biome"/>.</param> /// <param name="in_entryRequirements">Describes the <see cref="Item"/>s needed to access this <see cref="Biome"/>.</param> public Biome(GameObjectID in_id, string in_name, string in_description, string in_comment, int in_tier, Elevation in_elevationCategory, bool in_isLiquidBased, List <GameObjectTag> in_parquetCriteria, List <GameObjectTag> in_entryRequirements) : base(All.BiomeIDs, in_id, in_name, in_description, in_comment) { Precondition.MustBeNonNegative(in_tier, nameof(in_tier)); Tier = in_tier; ElevationCategory = in_elevationCategory; IsLiquidBased = in_isLiquidBased; ParquetCriteria = (in_parquetCriteria ?? Enumerable.Empty <GameObjectTag>()).ToList(); EntryRequirements = (in_entryRequirements ?? Enumerable.Empty <GameObjectTag>()).ToList(); }
public void MustBeNonNegativeThrowsOnNegativeTest() { var testValue = -1; Assert.Throws <ArgumentOutOfRangeException>(() => Precondition.MustBeNonNegative(testValue)); }