diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 14b1752..ebdec12 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -25,7 +25,7 @@
$(MSBuildThisFileDirectory)..\artifacts
- 1.4.15-rc.3
+ 1.4.17
diff --git a/src/Primitively.Abstractions/Primitively.Abstractions.csproj b/src/Primitively.Abstractions/Primitively.Abstractions.csproj
index 89cbeed..d4f15f6 100644
--- a/src/Primitively.Abstractions/Primitively.Abstractions.csproj
+++ b/src/Primitively.Abstractions/Primitively.Abstractions.csproj
@@ -16,7 +16,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/src/Primitively.AspNetCore.Mvc/Primitively.AspNetCore.Mvc.csproj b/src/Primitively.AspNetCore.Mvc/Primitively.AspNetCore.Mvc.csproj
index 8c17a7d..04e5f27 100644
--- a/src/Primitively.AspNetCore.Mvc/Primitively.AspNetCore.Mvc.csproj
+++ b/src/Primitively.AspNetCore.Mvc/Primitively.AspNetCore.Mvc.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/src/Primitively/EmbeddedResources/Integer/Base.cs b/src/Primitively/EmbeddedResources/Integer/Base.cs
index ae0ebb1..3e8cf45 100644
--- a/src/Primitively/EmbeddedResources/Integer/Base.cs
+++ b/src/Primitively/EmbeddedResources/Integer/Base.cs
@@ -2,23 +2,30 @@
{
private readonly global::PRIMITIVE_VALUE_TYPE _value = default;
- public const string Example = @"PRIMITIVE_EXAMPLE";
+ public const string Example = "PRIMITIVE_EXAMPLE";
public const global::PRIMITIVE_VALUE_TYPE Minimum = PRIMITIVE_MINIMUM;
public const global::PRIMITIVE_VALUE_TYPE Maximum = PRIMITIVE_MAXIMUM;
+ public PRIMITIVE_TYPE()
+ {
+ HasValue = _value >= Minimum && _value <= Maximum;
+ }
+
public PRIMITIVE_TYPE(global::PRIMITIVE_VALUE_TYPE value)
{
- if (value >= PRIMITIVE_MINIMUM && value <= PRIMITIVE_MAXIMUM)
+ if (value >= Minimum && value <= Maximum)
{
_value = value;
+ HasValue = true;
}
}
private PRIMITIVE_TYPE(string value)
{
- if (global::PRIMITIVE_VALUE_TYPE.TryParse(value, out var result) && result >= PRIMITIVE_MINIMUM && result <= PRIMITIVE_MAXIMUM)
+ if (global::PRIMITIVE_VALUE_TYPE.TryParse(value, out var result) && result >= Minimum && result <= Maximum)
{
_value = result;
+ HasValue = true;
}
}
@@ -27,7 +34,7 @@ private PRIMITIVE_TYPE(string value)
global::PRIMITIVE_VALUE_TYPE global::Primitively.IPrimitive.Value => _value;
[global::System.Text.Json.Serialization.JsonIgnore]
- public bool HasValue => _value != default;
+ public bool HasValue { get; } = false;
[global::System.Text.Json.Serialization.JsonIgnore]
public global::System.Type ValueType => typeof(global::PRIMITIVE_VALUE_TYPE);
diff --git a/test/Acme.TestLib/Acme.TestLib.csproj b/test/Acme.TestLib/Acme.TestLib.csproj
index 3a7e3a7..829f97e 100644
--- a/test/Acme.TestLib/Acme.TestLib.csproj
+++ b/test/Acme.TestLib/Acme.TestLib.csproj
@@ -25,7 +25,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/test/Acme.TestLib2/Acme.TestLib2.csproj b/test/Acme.TestLib2/Acme.TestLib2.csproj
index b1fe6e9..241f0a1 100644
--- a/test/Acme.TestLib2/Acme.TestLib2.csproj
+++ b/test/Acme.TestLib2/Acme.TestLib2.csproj
@@ -25,7 +25,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/test/Primitively.IntegrationTests/IntegerTests/Byte/FluentValidationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/Byte/FluentValidationTests.cs
index 9930eb0..f4a42e6 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/Byte/FluentValidationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/Byte/FluentValidationTests.cs
@@ -25,8 +25,9 @@ public FluentValidationTests()
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1")]
+ [InlineData("0", true, true)]
+ [InlineData("00", true, true)]
[InlineData("001", true, true)]
[InlineData(ByteId.Example, true, true)]
public void ConvertFromThisToThatWithExpectedResults(string? value, bool nonNullableIsValid = false, bool nullableIsValid = false)
diff --git a/test/Primitively.IntegrationTests/IntegerTests/Byte/InstantiationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/Byte/InstantiationTests.cs
index 650ae81..2a97741 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/Byte/InstantiationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/Byte/InstantiationTests.cs
@@ -10,31 +10,15 @@ public class InstantiationTests
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1")]
+ [InlineData("0", true)]
+ [InlineData("00", true)]
[InlineData("001", true)]
[InlineData(ByteId.Example, true)]
- public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = default)
+ public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = false)
{
- var expectedInteger = hasValue ? ByteId.Parse(from) : default;
- var expectedString = expectedInteger.ToString();
-
- var @this = (ByteId)from;
- string to = @this;
- var that = ByteId.Parse(to);
- var and = new ByteId(that);
- string back = and;
+ var @this = ByteId.Parse(from);
@this.HasValue.Should().Be(hasValue);
- @this.Should().Be(expectedInteger);
- @this.ToString().Should().Be(expectedString);
- to.Should().Be(expectedString);
- that.HasValue.Should().Be(hasValue);
- that.Should().Be(expectedInteger);
- that.ToString().Should().Be(expectedString);
- and.HasValue.Should().Be(hasValue);
- and.Should().Be(expectedInteger);
- and.ToString().Should().Be(expectedString);
- back.Should().Be(expectedString);
}
}
diff --git a/test/Primitively.IntegrationTests/IntegerTests/Int/FluentValidationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/Int/FluentValidationTests.cs
index 819468c..528fefb 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/Int/FluentValidationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/Int/FluentValidationTests.cs
@@ -25,8 +25,9 @@ public FluentValidationTests()
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1", true, true)]
+ [InlineData("0", true, true)]
+ [InlineData("00", true, true)]
[InlineData("001", true, true)]
[InlineData(IntId.Example, true, true)]
public void ConvertFromThisToThatWithExpectedResults(string? value, bool nonNullableIsValid = false, bool nullableIsValid = false)
diff --git a/test/Primitively.IntegrationTests/IntegerTests/Int/InstantiationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/Int/InstantiationTests.cs
index 3ae864b..34addab 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/Int/InstantiationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/Int/InstantiationTests.cs
@@ -10,31 +10,15 @@ public class InstantiationTests
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1", true)]
+ [InlineData("0", true)]
+ [InlineData("00", true)]
[InlineData("001", true)]
[InlineData(IntId.Example, true)]
- public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = default)
+ public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = false)
{
- var expectedInteger = hasValue ? IntId.Parse(from) : default;
- var expectedString = expectedInteger.ToString();
-
- var @this = (IntId)from;
- string to = @this;
- var that = IntId.Parse(to);
- var and = new IntId(that);
- string back = and;
+ var @this = IntId.Parse(from);
@this.HasValue.Should().Be(hasValue);
- @this.Should().Be(expectedInteger);
- @this.ToString().Should().Be(expectedString);
- to.Should().Be(expectedString);
- that.HasValue.Should().Be(hasValue);
- that.Should().Be(expectedInteger);
- that.ToString().Should().Be(expectedString);
- and.HasValue.Should().Be(hasValue);
- and.Should().Be(expectedInteger);
- and.ToString().Should().Be(expectedString);
- back.Should().Be(expectedString);
}
}
diff --git a/test/Primitively.IntegrationTests/IntegerTests/Int/ValidateMethodTests.cs b/test/Primitively.IntegrationTests/IntegerTests/Int/ValidateMethodTests.cs
index bc95df5..ddf3025 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/Int/ValidateMethodTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/Int/ValidateMethodTests.cs
@@ -11,8 +11,9 @@ public class ValidateMethodTests
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1", true)]
+ [InlineData("0", true)]
+ [InlineData("00", true)]
[InlineData("001", true)]
[InlineData(ValidatableInteger.Example, true)]
public void ConvertFromThisToThatWithExpectedResults(string? value, bool isValid = false)
diff --git a/test/Primitively.IntegrationTests/IntegerTests/Long/FluentValidationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/Long/FluentValidationTests.cs
index fee756f..3c71f34 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/Long/FluentValidationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/Long/FluentValidationTests.cs
@@ -25,8 +25,9 @@ public FluentValidationTests()
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1", true, true)]
+ [InlineData("0", true, true)]
+ [InlineData("00", true, true)]
[InlineData("001", true, true)]
[InlineData(LongId.Example, true, true)]
public void ConvertFromThisToThatWithExpectedResults(string? value, bool nonNullableIsValid = false, bool nullableIsValid = false)
diff --git a/test/Primitively.IntegrationTests/IntegerTests/Long/InstantiationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/Long/InstantiationTests.cs
index cadee51..55f1ff2 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/Long/InstantiationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/Long/InstantiationTests.cs
@@ -10,31 +10,15 @@ public class InstantiationTests
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1", true)]
+ [InlineData("0", true)]
+ [InlineData("00", true)]
[InlineData("001", true)]
[InlineData(LongId.Example, true)]
- public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = default)
+ public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = false)
{
- var expectedInteger = hasValue ? LongId.Parse(from) : default;
- var expectedString = expectedInteger.ToString();
-
- var @this = (LongId)from;
- string to = @this;
- var that = LongId.Parse(to);
- var and = new LongId(that);
- string back = and;
+ var @this = LongId.Parse(from);
@this.HasValue.Should().Be(hasValue);
- @this.Should().Be(expectedInteger);
- @this.ToString().Should().Be(expectedString);
- to.Should().Be(expectedString);
- that.HasValue.Should().Be(hasValue);
- that.Should().Be(expectedInteger);
- that.ToString().Should().Be(expectedString);
- and.HasValue.Should().Be(hasValue);
- and.Should().Be(expectedInteger);
- and.ToString().Should().Be(expectedString);
- back.Should().Be(expectedString);
}
}
diff --git a/test/Primitively.IntegrationTests/IntegerTests/SByte/FluentValidationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/SByte/FluentValidationTests.cs
index 9a1e0a8..61d1bdb 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/SByte/FluentValidationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/SByte/FluentValidationTests.cs
@@ -25,8 +25,9 @@ public FluentValidationTests()
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1", true, true)]
+ [InlineData("0", true, true)]
+ [InlineData("00", true, true)]
[InlineData("001", true, true)]
[InlineData(SByteId.Example, true, true)]
public void ConvertFromThisToThatWithExpectedResults(string? value, bool nonNullableIsValid = false, bool nullableIsValid = false)
diff --git a/test/Primitively.IntegrationTests/IntegerTests/SByte/InstantiationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/SByte/InstantiationTests.cs
index 4cb266f..92e2b5b 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/SByte/InstantiationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/SByte/InstantiationTests.cs
@@ -10,31 +10,15 @@ public class InstantiationTests
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1", true)]
+ [InlineData("0", true)]
+ [InlineData("00", true)]
[InlineData("001", true)]
[InlineData(SByteId.Example, true)]
- public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = default)
+ public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = false)
{
- var expectedInteger = hasValue ? SByteId.Parse(from) : default;
- var expectedString = expectedInteger.ToString();
-
- var @this = (SByteId)from;
- string to = @this;
- var that = SByteId.Parse(to);
- var and = new SByteId(that);
- string back = and;
+ var @this = SByteId.Parse(from);
@this.HasValue.Should().Be(hasValue);
- @this.Should().Be(expectedInteger);
- @this.ToString().Should().Be(expectedString);
- to.Should().Be(expectedString);
- that.HasValue.Should().Be(hasValue);
- that.Should().Be(expectedInteger);
- that.ToString().Should().Be(expectedString);
- and.HasValue.Should().Be(hasValue);
- and.Should().Be(expectedInteger);
- and.ToString().Should().Be(expectedString);
- back.Should().Be(expectedString);
}
}
diff --git a/test/Primitively.IntegrationTests/IntegerTests/Short/FluentValidationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/Short/FluentValidationTests.cs
index 3313273..62b4a78 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/Short/FluentValidationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/Short/FluentValidationTests.cs
@@ -25,8 +25,9 @@ public FluentValidationTests()
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1", true, true)]
+ [InlineData("0", true, true)]
+ [InlineData("00", true, true)]
[InlineData("001", true, true)]
[InlineData(ShortId.Example, true, true)]
public void ConvertFromThisToThatWithExpectedResults(string? value, bool nonNullableIsValid = false, bool nullableIsValid = false)
diff --git a/test/Primitively.IntegrationTests/IntegerTests/Short/InstantiationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/Short/InstantiationTests.cs
index 8dc042f..0fb6b48 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/Short/InstantiationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/Short/InstantiationTests.cs
@@ -10,31 +10,15 @@ public class InstantiationTests
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1", true)]
+ [InlineData("0", true)]
+ [InlineData("00", true)]
[InlineData("001", true)]
[InlineData(ShortId.Example, true)]
- public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = default)
+ public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = false)
{
- var expectedInteger = hasValue ? ShortId.Parse(from) : default;
- var expectedString = expectedInteger.ToString();
-
- var @this = (ShortId)from;
- string to = @this;
- var that = ShortId.Parse(to);
- var and = new ShortId(that);
- string back = and;
+ var @this = ShortId.Parse(from);
@this.HasValue.Should().Be(hasValue);
- @this.Should().Be(expectedInteger);
- @this.ToString().Should().Be(expectedString);
- to.Should().Be(expectedString);
- that.HasValue.Should().Be(hasValue);
- that.Should().Be(expectedInteger);
- that.ToString().Should().Be(expectedString);
- and.HasValue.Should().Be(hasValue);
- and.Should().Be(expectedInteger);
- and.ToString().Should().Be(expectedString);
- back.Should().Be(expectedString);
}
}
diff --git a/test/Primitively.IntegrationTests/IntegerTests/UInt/FluentValidationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/UInt/FluentValidationTests.cs
index f4faa71..889eb69 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/UInt/FluentValidationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/UInt/FluentValidationTests.cs
@@ -25,8 +25,9 @@ public FluentValidationTests()
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1")]
+ [InlineData("0", true, true)]
+ [InlineData("00", true, true)]
[InlineData("001", true, true)]
[InlineData(UIntId.Example, true, true)]
public void ConvertFromThisToThatWithExpectedResults(string? value, bool nonNullableIsValid = false, bool nullableIsValid = false)
diff --git a/test/Primitively.IntegrationTests/IntegerTests/UInt/InstantiationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/UInt/InstantiationTests.cs
index d70f62c..538e66c 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/UInt/InstantiationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/UInt/InstantiationTests.cs
@@ -10,31 +10,15 @@ public class InstantiationTests
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1")]
+ [InlineData("0", true)]
+ [InlineData("00", true)]
[InlineData("001", true)]
[InlineData(UIntId.Example, true)]
- public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = default)
+ public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = false)
{
- var expectedInteger = hasValue ? UIntId.Parse(from) : default;
- var expectedString = expectedInteger.ToString();
-
- var @this = (UIntId)from;
- string to = @this;
- var that = UIntId.Parse(to);
- var and = new UIntId(that);
- string back = and;
+ var @this = UIntId.Parse(from);
@this.HasValue.Should().Be(hasValue);
- @this.Should().Be(expectedInteger);
- @this.ToString().Should().Be(expectedString);
- to.Should().Be(expectedString);
- that.HasValue.Should().Be(hasValue);
- that.Should().Be(expectedInteger);
- that.ToString().Should().Be(expectedString);
- and.HasValue.Should().Be(hasValue);
- and.Should().Be(expectedInteger);
- and.ToString().Should().Be(expectedString);
- back.Should().Be(expectedString);
}
}
diff --git a/test/Primitively.IntegrationTests/IntegerTests/ULong/FluentValidationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/ULong/FluentValidationTests.cs
index d66e4d8..29a9c32 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/ULong/FluentValidationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/ULong/FluentValidationTests.cs
@@ -25,8 +25,9 @@ public FluentValidationTests()
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1")]
+ [InlineData("0", true, true)]
+ [InlineData("00", true, true)]
[InlineData("001", true, true)]
[InlineData(ULongId.Example, true, true)]
public void ConvertFromThisToThatWithExpectedResults(string? value, bool nonNullableIsValid = false, bool nullableIsValid = false)
diff --git a/test/Primitively.IntegrationTests/IntegerTests/ULong/InstantiationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/ULong/InstantiationTests.cs
index 506bf97..b365f91 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/ULong/InstantiationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/ULong/InstantiationTests.cs
@@ -10,31 +10,15 @@ public class InstantiationTests
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1")]
+ [InlineData("0", true)]
+ [InlineData("00", true)]
[InlineData("001", true)]
[InlineData(ULongId.Example, true)]
- public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = default)
+ public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = false)
{
- var expectedInteger = hasValue ? ULongId.Parse(from) : default;
- var expectedString = expectedInteger.ToString();
-
- var @this = (ULongId)from;
- string to = @this;
- var that = ULongId.Parse(to);
- var and = new ULongId(that);
- string back = and;
+ var @this = ULongId.Parse(from);
@this.HasValue.Should().Be(hasValue);
- @this.Should().Be(expectedInteger);
- @this.ToString().Should().Be(expectedString);
- to.Should().Be(expectedString);
- that.HasValue.Should().Be(hasValue);
- that.Should().Be(expectedInteger);
- that.ToString().Should().Be(expectedString);
- and.HasValue.Should().Be(hasValue);
- and.Should().Be(expectedInteger);
- and.ToString().Should().Be(expectedString);
- back.Should().Be(expectedString);
}
}
diff --git a/test/Primitively.IntegrationTests/IntegerTests/UShort/FluentValidationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/UShort/FluentValidationTests.cs
index c5664f5..dc5b4ea 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/UShort/FluentValidationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/UShort/FluentValidationTests.cs
@@ -25,8 +25,9 @@ public FluentValidationTests()
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1")]
+ [InlineData("0", true, true)]
+ [InlineData("00", true, true)]
[InlineData("001", true, true)]
[InlineData(UShortId.Example, true, true)]
public void ConvertFromThisToThatWithExpectedResults(string? value, bool nonNullableIsValid = false, bool nullableIsValid = false)
diff --git a/test/Primitively.IntegrationTests/IntegerTests/UShort/InstantiationTests.cs b/test/Primitively.IntegrationTests/IntegerTests/UShort/InstantiationTests.cs
index e2220b8..7b7993a 100644
--- a/test/Primitively.IntegrationTests/IntegerTests/UShort/InstantiationTests.cs
+++ b/test/Primitively.IntegrationTests/IntegerTests/UShort/InstantiationTests.cs
@@ -10,31 +10,15 @@ public class InstantiationTests
[InlineData("")]
[InlineData(" ")]
[InlineData(" ")]
- [InlineData("0")]
- [InlineData("00")]
+ [InlineData("-1")]
+ [InlineData("0", true)]
+ [InlineData("00", true)]
[InlineData("001", true)]
[InlineData(UShortId.Example, true)]
- public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = default)
+ public void ConvertFromThisToThatWithExpectedResults(string? from, bool hasValue = false)
{
- var expectedInteger = hasValue ? UShortId.Parse(from) : default;
- var expectedString = expectedInteger.ToString();
-
- var @this = (UShortId)from;
- string to = @this;
- var that = UShortId.Parse(to);
- var and = new UShortId(that);
- string back = and;
+ var @this = UShortId.Parse(from);
@this.HasValue.Should().Be(hasValue);
- @this.Should().Be(expectedInteger);
- @this.ToString().Should().Be(expectedString);
- to.Should().Be(expectedString);
- that.HasValue.Should().Be(hasValue);
- that.Should().Be(expectedInteger);
- that.ToString().Should().Be(expectedString);
- and.HasValue.Should().Be(hasValue);
- and.Should().Be(expectedInteger);
- and.ToString().Should().Be(expectedString);
- back.Should().Be(expectedString);
}
}
diff --git a/test/Primitively.IntegrationTests/PrimitiveJsonConverterTests.cs b/test/Primitively.IntegrationTests/PrimitiveJsonConverterTests.cs
index 6edf3c7..d70da57 100644
--- a/test/Primitively.IntegrationTests/PrimitiveJsonConverterTests.cs
+++ b/test/Primitively.IntegrationTests/PrimitiveJsonConverterTests.cs
@@ -48,7 +48,7 @@ public void JsonConverter_CanReadDefault()
var result = converter.Read(ref reader, typeof(TPrimitive), new JsonSerializerOptions());
result.Should().BeAssignableTo(typeof(TPrimitive));
- result.Should().BeEquivalentTo(default(TPrimitive));
+ result.Should().BeEquivalentTo(new TPrimitive());
}
[Fact]
diff --git a/test/Primitively.IntegrationTests/Primitively.IntegrationTests.csproj b/test/Primitively.IntegrationTests/Primitively.IntegrationTests.csproj
index 6c83200..d7908b1 100644
--- a/test/Primitively.IntegrationTests/Primitively.IntegrationTests.csproj
+++ b/test/Primitively.IntegrationTests/Primitively.IntegrationTests.csproj
@@ -25,7 +25,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all