-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
3,030 additions
and
3,188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,35 @@ | ||
using NUnit.Framework; | ||
using Qowaiv; | ||
using Qowaiv.Financial; | ||
using Qowaiv.TestTools; | ||
namespace Cast_specs; | ||
|
||
namespace Cast_specs | ||
public class Invalid | ||
{ | ||
public class Invalid | ||
{ | ||
[TestCase(double.MaxValue)] | ||
[TestCase(double.MinValue)] | ||
[TestCase(double.NaN)] | ||
[TestCase(double.NegativeInfinity)] | ||
[TestCase(double.PositiveInfinity)] | ||
public void double_to_Percentage(double num) => QAssert.InvalidCast(() => (Percentage)num); | ||
[TestCase(double.MaxValue)] | ||
[TestCase(double.MinValue)] | ||
[TestCase(double.NaN)] | ||
[TestCase(double.NegativeInfinity)] | ||
[TestCase(double.PositiveInfinity)] | ||
public void double_to_Percentage(double num) => QAssert.InvalidCast(() => (Percentage)num); | ||
|
||
[TestCase(double.MaxValue)] | ||
[TestCase(double.MinValue)] | ||
[TestCase(double.NaN)] | ||
[TestCase(double.NegativeInfinity)] | ||
[TestCase(double.PositiveInfinity)] | ||
public void double_to_Amount(double num) => QAssert.InvalidCast(() => (Amount)num); | ||
[TestCase(double.MaxValue)] | ||
[TestCase(double.MinValue)] | ||
[TestCase(double.NaN)] | ||
[TestCase(double.NegativeInfinity)] | ||
[TestCase(double.PositiveInfinity)] | ||
public void double_to_Amount(double num) => QAssert.InvalidCast(() => (Amount)num); | ||
|
||
|
||
[TestCase(int.MaxValue)] | ||
[TestCase(1_000_000_000)] | ||
public void int_to_HouseNumber(int num) => QAssert.InvalidCast(() => (HouseNumber)num); | ||
[TestCase(int.MaxValue)] | ||
[TestCase(1_000_000_000)] | ||
public void int_to_HouseNumber(int num) => QAssert.InvalidCast(() => (HouseNumber)num); | ||
|
||
[TestCase(int.MaxValue)] | ||
[TestCase(1_000_000)] | ||
[TestCase(-1)] | ||
[TestCase(13)] | ||
public void int_to_Month(int num) => QAssert.InvalidCast(() => (Month)num); | ||
[TestCase(int.MaxValue)] | ||
[TestCase(1_000_000)] | ||
[TestCase(-1)] | ||
[TestCase(13)] | ||
public void int_to_Month(int num) => QAssert.InvalidCast(() => (Month)num); | ||
|
||
[TestCase(int.MaxValue)] | ||
[TestCase(1_000_000)] | ||
[TestCase(-1)] | ||
[TestCase(10_000)] | ||
public void int_to_Year(int num) => QAssert.InvalidCast(() => (Year)num); | ||
} | ||
[TestCase(int.MaxValue)] | ||
[TestCase(1_000_000)] | ||
[TestCase(-1)] | ||
[TestCase(10_000)] | ||
public void int_to_Year(int num) => QAssert.InvalidCast(() => (Year)num); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,74 @@ | ||
using FluentAssertions; | ||
using NUnit.Framework; | ||
using Qowaiv.Formatting; | ||
using Qowaiv.Globalization; | ||
using Qowaiv.Json; | ||
using Qowaiv.Text; | ||
using System; | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
namespace Debug_specs; | ||
|
||
namespace Debug_specs | ||
public class Type_is | ||
{ | ||
public class Type_is | ||
{ | ||
[TestCase(typeof(CultureInfoScope))] | ||
[TestCase(typeof(FormattingArguments))] | ||
[TestCase(typeof(PostalCodeCountryInfo))] | ||
[TestCase(typeof(WildcardPattern))] | ||
public void decorated_with_DebuggerDisplay_attribute(Type svoType) | ||
=> svoType.Should().BeDecoratedWith<DebuggerDisplayAttribute>(); | ||
} | ||
[TestCase(typeof(CultureInfoScope))] | ||
[TestCase(typeof(FormattingArguments))] | ||
[TestCase(typeof(PostalCodeCountryInfo))] | ||
[TestCase(typeof(WildcardPattern))] | ||
public void decorated_with_DebuggerDisplay_attribute(Type svoType) | ||
=> svoType.Should().BeDecoratedWith<DebuggerDisplayAttribute>(); | ||
} | ||
|
||
public class Debugger_displays | ||
public class Debugger_displays | ||
{ | ||
[Test] | ||
public void Open_API_data() | ||
{ | ||
[Test] | ||
public void Open_API_data() | ||
{ | ||
var attribute = new OpenApiDataTypeAttribute( | ||
description: "Year", | ||
example: "1983", | ||
type: "integer", | ||
format: "0000", | ||
nullable: true, | ||
pattern: "^[0-9]{4}$"); | ||
var attribute = new OpenApiDataTypeAttribute( | ||
description: "Year", | ||
example: "1983", | ||
type: "integer", | ||
format: "0000", | ||
nullable: true, | ||
pattern: "^[0-9]{4}$"); | ||
|
||
attribute.Should().HaveDebuggerDisplay("{ type: integer, desc: Year, example: 1983, format: 0000, pattern: ^[0-9]{4}$, nullable: true }"); | ||
} | ||
attribute.Should().HaveDebuggerDisplay("{ type: integer, desc: Year, example: 1983, format: 0000, pattern: ^[0-9]{4}$, nullable: true }"); | ||
} | ||
|
||
[Test] | ||
public void empty_postal_code_country_data_for_empty_country() | ||
=> PostalCodeCountryInfo.GetInstance(Country.Empty) | ||
.Should().HaveDebuggerDisplay("Postal code[], none"); | ||
[Test] | ||
public void empty_postal_code_country_data_for_empty_country() | ||
=> PostalCodeCountryInfo.GetInstance(Country.Empty) | ||
.Should().HaveDebuggerDisplay("Postal code[], none"); | ||
|
||
[Test] | ||
public void postal_code_pattern_and_county_for_county_with_postal_codes() | ||
=> PostalCodeCountryInfo.GetInstance(Country.BE) | ||
.Should().HaveDebuggerDisplay("Postal code[BE], Pattern: ^[1-9][0-9]{3}$"); | ||
[Test] | ||
public void postal_code_pattern_and_county_for_county_with_postal_codes() | ||
=> PostalCodeCountryInfo.GetInstance(Country.BE) | ||
.Should().HaveDebuggerDisplay("Postal code[BE], Pattern: ^[1-9][0-9]{3}$"); | ||
|
||
[Test] | ||
public void postal_code_value_and_county_for_county_with_one_postal_code() | ||
=> PostalCodeCountryInfo.GetInstance(Country.VA) | ||
.Should().HaveDebuggerDisplay("Postal code[VA], Value: 00120"); | ||
[Test] | ||
public void postal_code_value_and_county_for_county_with_one_postal_code() | ||
=> PostalCodeCountryInfo.GetInstance(Country.VA) | ||
.Should().HaveDebuggerDisplay("Postal code[VA], Value: 00120"); | ||
|
||
[Test] | ||
public void current_and_previous_cultures_for_culture_info_scope() | ||
[Test] | ||
public void current_and_previous_cultures_for_culture_info_scope() | ||
{ | ||
using (new CultureInfoScope("en-NL", "en-US")) | ||
{ | ||
using (new CultureInfoScope("en-NL", "en-US")) | ||
{ | ||
using var scope = new CultureInfoScope("es-ES", "fr-FR"); | ||
scope.Should().HaveDebuggerDisplay("CultureInfoScope: [es-ES/fr-FR], Previous: [en-NL/en-US]"); | ||
} | ||
using var scope = new CultureInfoScope("es-ES", "fr-FR"); | ||
scope.Should().HaveDebuggerDisplay("CultureInfoScope: [es-ES/fr-FR], Previous: [en-NL/en-US]"); | ||
} | ||
|
||
[Test] | ||
public void formatting_arguments_without_pattern_if_not_specified() | ||
=> ((object)new FormattingArgumentsCollection(new CultureInfo("en-GB"))) | ||
.Should().HaveDebuggerDisplay("FormattingArgumentsCollection: 'en-GB', Items: 0"); | ||
} | ||
|
||
[Test] | ||
public void formatting_arguments_without_pattern_if_not_specified() | ||
=> ((object)new FormattingArgumentsCollection(new CultureInfo("en-GB"))) | ||
.Should().HaveDebuggerDisplay("FormattingArgumentsCollection: 'en-GB', Items: 0"); | ||
|
||
[Test] | ||
public void formatting_arguments_with_pattern_if_specified() | ||
=> new FormattingArguments("yyyy-MM-dd", new CultureInfo("en-GB")) | ||
.Should().HaveDebuggerDisplay("Format: 'yyyy-MM-dd', Provider: en-GB"); | ||
|
||
[Test] | ||
public void wildcard_pattern() | ||
=> new WildcardPattern("t?st*") | ||
.Should().HaveDebuggerDisplay("{t?st*}"); | ||
[Test] | ||
public void formatting_arguments_with_pattern_if_specified() | ||
=> new FormattingArguments("yyyy-MM-dd", new CultureInfo("en-GB")) | ||
.Should().HaveDebuggerDisplay("Format: 'yyyy-MM-dd', Provider: en-GB"); | ||
|
||
[Test] | ||
public void wildcard_pattern_with_options_if_not_default() | ||
=> new WildcardPattern("t?st*", WildcardPatternOptions.SingleOrTrailing, StringComparison.Ordinal) | ||
.Should().HaveDebuggerDisplay("{t?st*}, SingleOrTrailing, Ordinal"); | ||
} | ||
[Test] | ||
public void wildcard_pattern() | ||
=> new WildcardPattern("t?st*") | ||
.Should().HaveDebuggerDisplay("{t?st*}"); | ||
|
||
[Test] | ||
public void wildcard_pattern_with_options_if_not_default() | ||
=> new WildcardPattern("t?st*", WildcardPatternOptions.SingleOrTrailing, StringComparison.Ordinal) | ||
.Should().HaveDebuggerDisplay("{t?st*}, SingleOrTrailing, Ordinal"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
using FluentAssertions; | ||
using NUnit.Framework; | ||
using Qowaiv.Statistics; | ||
using System.Linq; | ||
namespace Extensions.Enumerable_specs; | ||
|
||
namespace Extensions.Enumerable_specs | ||
public class Average | ||
{ | ||
public class Average | ||
[Test] | ||
public void Elo() | ||
{ | ||
[Test] | ||
public void Elo() | ||
{ | ||
var elos = new Elo[] { 1400, 1600 }; | ||
elos.Average().Should().Be(1500.Elo()); | ||
} | ||
var elos = new Elo[] { 1400, 1600 }; | ||
elos.Average().Should().Be(1500.Elo()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.