-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optional: Improve ToString tests / test cases
- Loading branch information
Showing
8 changed files
with
223 additions
and
68 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...-taggeds-optional/Optional.Tests/Optional.Test/OptionalTest.Factory.Absent.Constructor.cs
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#nullable enable | ||
|
||
using NUnit.Framework; | ||
using PrimeFuncPack.UnitTest; | ||
|
||
namespace PrimeFuncPack.Core.Tests | ||
{ | ||
partial class OptionalTest | ||
{ | ||
[Test] | ||
public void Absent_Constructor_ExpectAbsentIsTrue() | ||
{ | ||
var actual = new Optional<RefType>(); | ||
Assert.True(actual.IsAbsent); | ||
} | ||
|
||
[Test] | ||
public void Absent_Constructor_ExpectPresentIsFalse() | ||
{ | ||
var actual = new Optional<RefType>(); | ||
Assert.False(actual.IsPresent); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...core-taggeds-optional/Optional.Tests/Optional.Test/OptionalTest.Factory.Absent.Default.cs
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#nullable enable | ||
|
||
using NUnit.Framework; | ||
using PrimeFuncPack.UnitTest; | ||
|
||
namespace PrimeFuncPack.Core.Tests | ||
{ | ||
partial class OptionalTest | ||
{ | ||
[Test] | ||
public void Absent_Default_ExpectAbsentIsTrue() | ||
{ | ||
var actual = default(Optional<RefType>); | ||
Assert.True(actual.IsAbsent); | ||
} | ||
|
||
[Test] | ||
public void Absent_Default_ExpectPresentIsFalse() | ||
{ | ||
var actual = default(Optional<RefType>); | ||
Assert.False(actual.IsPresent); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/core-taggeds-optional/Optional.Tests/Optional.Test/OptionalTest.Factory.Absent.Value.cs
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#nullable enable | ||
|
||
using NUnit.Framework; | ||
using PrimeFuncPack.UnitTest; | ||
|
||
namespace PrimeFuncPack.Core.Tests | ||
{ | ||
partial class OptionalTest | ||
{ | ||
[Test] | ||
public void Absent_Value_ExpectAbsentIsTrue() | ||
{ | ||
var actual = Optional<StructType>.Absent; | ||
Assert.True(actual.IsAbsent); | ||
} | ||
|
||
[Test] | ||
public void Absent_Value_ExpectPresentIsFalse() | ||
{ | ||
var actual = Optional<StructType>.Absent; | ||
Assert.False(actual.IsPresent); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...taggeds-optional/Optional.Tests/Optional.Test/OptionalTest.Factory.Present.Constructor.cs
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#nullable enable | ||
|
||
using NUnit.Framework; | ||
using PrimeFuncPack.UnitTest; | ||
using static PrimeFuncPack.UnitTest.TestData; | ||
|
||
namespace PrimeFuncPack.Core.Tests | ||
{ | ||
partial class OptionalTest | ||
{ | ||
[Test] | ||
public void Present_Constructor_SourceIsNull_ExpectPresentIsTrue() | ||
{ | ||
var actual = new Optional<StructType?>(null); | ||
Assert.True(actual.IsPresent); | ||
} | ||
|
||
[Test] | ||
public void Present_Constructor_SourceIsNull_ExpectAbsentIsFalse() | ||
{ | ||
var actual = new Optional<StructType?>(null); | ||
Assert.False(actual.IsAbsent); | ||
} | ||
|
||
[Test] | ||
public void Present_Constructor_SourceIsNotNull_ExpectPresentIsTrue() | ||
{ | ||
var actual = new Optional<RefType>(PlusFifteenIdRefType); | ||
Assert.True(actual.IsPresent); | ||
} | ||
|
||
[Test] | ||
public void Present_Constructor_SourceIsNotNull_ExpectAbsentIsFalse() | ||
{ | ||
var actual = new Optional<RefType>(MinusFifteenIdRefType); | ||
Assert.False(actual.IsAbsent); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...re-taggeds-optional/Optional.Tests/Optional.Test/OptionalTest.Factory.Present.Explicit.cs
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#nullable enable | ||
|
||
using NUnit.Framework; | ||
using PrimeFuncPack.UnitTest; | ||
using static PrimeFuncPack.UnitTest.TestData; | ||
|
||
namespace PrimeFuncPack.Core.Tests | ||
{ | ||
partial class OptionalTest | ||
{ | ||
[Test] | ||
public void Present_Explicit_SourceIsNull_ExpectPresentIsTrue() | ||
{ | ||
var actual = Optional<StructType?>.Present(null); | ||
Assert.True(actual.IsPresent); | ||
} | ||
|
||
[Test] | ||
public void Present_Explicit_SourceIsNull_ExpectAbsentIsFalse() | ||
{ | ||
var actual = Optional<StructType?>.Present(null); | ||
Assert.False(actual.IsAbsent); | ||
} | ||
|
||
[Test] | ||
public void Present_Explicit_SourceIsNotNull_ExpectPresentIsTrue() | ||
{ | ||
var actual = Optional<RefType>.Present(PlusFifteenIdRefType); | ||
Assert.True(actual.IsPresent); | ||
} | ||
|
||
[Test] | ||
public void Present_Explicit_SourceIsNotNull_ExpectAbsentIsFalse() | ||
{ | ||
var actual = Optional<RefType>.Present(MinusFifteenIdRefType); | ||
Assert.False(actual.IsAbsent); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...re-taggeds-optional/Optional.Tests/Optional.Test/OptionalTest.Factory.Present.Implicit.cs
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#nullable enable | ||
|
||
using NUnit.Framework; | ||
using PrimeFuncPack.UnitTest; | ||
using static PrimeFuncPack.UnitTest.TestData; | ||
|
||
namespace PrimeFuncPack.Core.Tests | ||
{ | ||
partial class OptionalTest | ||
{ | ||
[Test] | ||
public void Present_Implicit_SourceIsNull_ExpectPresentIsTrue() | ||
{ | ||
var actual = Optional<StructType?>.Present(null); | ||
Assert.True(actual.IsPresent); | ||
} | ||
|
||
[Test] | ||
public void Present_Implicit_SourceIsNull_ExpectAbsentIsFalse() | ||
{ | ||
var actual = Optional<StructType?>.Present(null); | ||
Assert.False(actual.IsAbsent); | ||
} | ||
|
||
[Test] | ||
public void Present_Implicit_SourceIsNotNull_ExpectPresentIsTrue() | ||
{ | ||
var actual = Optional<RefType>.Present(PlusFifteenIdRefType); | ||
Assert.True(actual.IsPresent); | ||
} | ||
|
||
[Test] | ||
public void Present_Implicit_SourceIsNotNull_ExpectAbsentIsFalse() | ||
{ | ||
var actual = Optional<RefType>.Present(MinusFifteenIdRefType); | ||
Assert.False(actual.IsAbsent); | ||
} | ||
} | ||
} |
68 changes: 0 additions & 68 deletions
68
src/core-taggeds-optional/Optional.Tests/Optional.Test/OptionalTest.Factory.cs
This file was deleted.
Oops, something went wrong.
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