diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..659cdfb --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..20e7e01 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..8bfbeb7 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..7cfdd2b --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..4cad7b0 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new OutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + Action act = () => subject.Equals(other); + + // Assert + _ = Should.Throw(act); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..f98019b --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..a85bec1 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..3e4992c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..f82853d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + Action act = () => _ = (ImmutableArray)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..2911c13 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..e4fd170 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..0955260 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,22 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly string Expected = $"Inner {{ {typeof(ImmutableArray)} }}"; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string result = subject.ToString(); + + // Assert + result.ShouldBe(Expected); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..1774750 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + IOutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..48f9a40 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithIOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner? left = default; + IOutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner? left = default; + IOutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + IOutterForImmutableArray.Inner left = new(leftValues); + IOutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..d090c10 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithIOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithIOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..a0fed9e --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithIOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithIOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..66cb2b1 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..d50c73d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentIOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new IOutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + Action act = () => subject.Equals(other); + + // Assert + _ = Should.Throw(act); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..bcec7ef --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + IOutterForImmutableArray.Inner first = new(_firstValue); + IOutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + IOutterForImmutableArray.Inner first = new(_firstValue); + IOutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..793c6fb --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + IOutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..d6b34f2 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + IOutterForImmutableArray.Inner? subject = default; + + // Act + Action act = () => _ = (ImmutableArray)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..52f7506 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithIOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + IOutterForImmutableArray.Inner left = new(leftValues); + IOutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..a32e292 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..388a178 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,22 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly string Expected = $"Inner {{ {typeof(ImmutableArray)} }}"; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string result = subject.ToString(); + + // Assert + result.ShouldBe(Expected); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..0b97681 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..0d4a74d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..190cc9a --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..62f4dc0 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..5388283 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new OutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + Action act = () => subject.Equals(other); + + // Assert + _ = Should.Throw(act); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..e0ced72 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..aed304e --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..1fd772b --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..9fe6447 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + Action act = () => _ = (ImmutableArray)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..f3d3cc5 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..743ff66 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..48e7cb5 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,22 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly string Expected = $"Inner {{ {typeof(ImmutableArray)} }}"; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string result = subject.ToString(); + + // Assert + result.ShouldBe(Expected); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..62e0967 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..d753513 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..c3d258a --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..04cbc01 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..2d56753 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new OutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + Action act = () => subject.Equals(other); + + // Assert + _ = Should.Throw(act); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..0898d8d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..cffc9b2 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..c997bff --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..aa2e908 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + Action act = () => _ = (ImmutableArray)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..b5f9882 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..84eb0e9 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..64933f1 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,22 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly string Expected = $"Inner {{ {typeof(ImmutableArray)} }}"; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string result = subject.ToString(); + + // Assert + result.ShouldBe(Expected); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..608fe61 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..38ff15d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..32902a4 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..76877c5 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..69b9b68 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new OutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + Action act = () => subject.Equals(other); + + // Assert + _ = Should.Throw(act); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..7a8843d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..8504f6a --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..5a3a040 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..4863cc6 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + Action act = () => _ = (ImmutableArray)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..673648b --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..01ff34a --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..17b096c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,22 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly string Expected = $"Inner {{ {typeof(ImmutableArray)} }}"; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string result = subject.ToString(); + + // Assert + result.ShouldBe(Expected); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..f2967bd --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Classes.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + SimpleForImmutableArray instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..d41f000 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Classes.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + SimpleForImmutableArray? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithSimpleForImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithSimpleForImmutableArrayIsCalled.cs new file mode 100644 index 0000000..f35d082 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithSimpleForImmutableArrayIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Classes.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithSimpleForImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + SimpleForImmutableArray? left = default; + SimpleForImmutableArray? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + SimpleForImmutableArray? left = default; + SimpleForImmutableArray right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + SimpleForImmutableArray left = new(leftValues); + SimpleForImmutableArray right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..d54764d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..14ff91f --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Classes.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentSimpleForImmutableArrayThenReturnTrue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + object other = new SimpleForImmutableArray(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + object other = string.Empty; + + // Act + Action act = () => subject.Equals(other); + + // Assert + _ = Should.Throw(act); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualsWithSimpleForImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualsWithSimpleForImmutableArrayIsCalled.cs new file mode 100644 index 0000000..84649f2 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenEqualsWithSimpleForImmutableArrayIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithSimpleForImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..719b7cd --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Classes.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + SimpleForImmutableArray first = new(_firstValue); + SimpleForImmutableArray second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + SimpleForImmutableArray first = new(_firstValue); + SimpleForImmutableArray second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..add0bfa --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Classes.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + SimpleForImmutableArray result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..a65e7e7 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + SimpleForImmutableArray? subject = default; + + // Act + Action act = () => _ = (ImmutableArray)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..727c3ec --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Classes.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + SimpleForImmutableArray? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithSimpleForImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithSimpleForImmutableArrayIsCalled.cs new file mode 100644 index 0000000..47c5933 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithSimpleForImmutableArrayIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Classes.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithSimpleForImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + SimpleForImmutableArray left = new(leftValues); + SimpleForImmutableArray right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..aa13cf5 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Simple/SimpleForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,22 @@ +namespace Monify.Console.Classes.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly string Expected = $"SimpleForImmutableArray {{ {typeof(ImmutableArray)} }}"; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + string result = subject.ToString(); + + // Assert + result.ShouldBe(Expected); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..c3a9142 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..d86f269 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..6776909 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..5fadf36 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..7114cf5 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new OutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..e9bec05 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..104d33a --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..d54883b --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..103589d --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + Action act = () => _ = (ImmutableArray)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..451eae9 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..0f1b2d5 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..d480285 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string actual = subject.ToString(); + + // Assert + actual.ShouldBe("Inner { }"); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..3f27c12 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + IOutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..5e3d04a --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithIOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner? left = default; + IOutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner? left = default; + IOutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + IOutterForImmutableArray.Inner left = new(leftValues); + IOutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..7136271 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithIOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithIOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..87b3fe3 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithIOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithIOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..bdd383b --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..fc3326e --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentIOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new IOutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..bc28806 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + IOutterForImmutableArray.Inner first = new(_firstValue); + IOutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + IOutterForImmutableArray.Inner first = new(_firstValue); + IOutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..313f5ae --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + IOutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..94f5a0f --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + IOutterForImmutableArray.Inner? subject = default; + + // Act + Action act = () => _ = (ImmutableArray)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..2943598 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithIOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + IOutterForImmutableArray.Inner left = new(leftValues); + IOutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..559e8d6 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..64a6343 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string actual = subject.ToString(); + + // Assert + actual.ShouldBe("Inner { }"); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..68619ac --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..f0af24a --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..5de747f --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..8d25817 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..71e5d55 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new OutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..d352eac --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..6f48636 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..41cf4c1 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..298f02c --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + Action act = () => _ = (ImmutableArray)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..809a2d6 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..aae046f --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..32929b0 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string actual = subject.ToString(); + + // Assert + actual.ShouldBe("Inner { }"); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..9684e7a --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..949c679 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..51bc9d2 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..46b6bc8 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..d88bd10 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new OutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..b55028d --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..ddf6968 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..b49095b --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..0e31e3d --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + Action act = () => _ = (ImmutableArray)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..c6d9e57 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..071cd3c --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..acda113 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string actual = subject.ToString(); + + // Assert + actual.ShouldBe("Inner { }"); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..3569015 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..f7733be --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..9d6e018 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..bf21048 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..36d6809 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new OutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..37e40ce --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..ff6b073 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..d18c69f --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..4d99e76 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + Action act = () => _ = (ImmutableArray)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..eacc063 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..5639c9d --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..aa73335 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string actual = subject.ToString(); + + // Assert + actual.ShouldBe("Inner { }"); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..5e467b9 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + SimpleForImmutableArray instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..2674122 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Records.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + SimpleForImmutableArray? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithSimpleForImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithSimpleForImmutableArrayIsCalled.cs new file mode 100644 index 0000000..374fc87 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithSimpleForImmutableArrayIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Records.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithSimpleForImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + SimpleForImmutableArray? left = default; + SimpleForImmutableArray? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + SimpleForImmutableArray? left = default; + SimpleForImmutableArray right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + SimpleForImmutableArray left = new(leftValues); + SimpleForImmutableArray right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..adf0500 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..7355267 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Records.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentSimpleForImmutableArrayThenReturnTrue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + object other = new SimpleForImmutableArray(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + object other = string.Empty; + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualsWithSimpleForImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualsWithSimpleForImmutableArrayIsCalled.cs new file mode 100644 index 0000000..8530147 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenEqualsWithSimpleForImmutableArrayIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithSimpleForImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..bef51d2 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Records.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + SimpleForImmutableArray first = new(_firstValue); + SimpleForImmutableArray second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + SimpleForImmutableArray first = new(_firstValue); + SimpleForImmutableArray second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..9f810df --- /dev/null +++ b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + SimpleForImmutableArray result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..8fbe2d1 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + SimpleForImmutableArray? subject = default; + + // Act + Action act = () => _ = (ImmutableArray)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..01cef4d --- /dev/null +++ b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Records.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + SimpleForImmutableArray? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithSimpleForImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithSimpleForImmutableArrayIsCalled.cs new file mode 100644 index 0000000..338d8cd --- /dev/null +++ b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithSimpleForImmutableArrayIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Records.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithSimpleForImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + SimpleForImmutableArray left = new(leftValues); + SimpleForImmutableArray right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..e26fc0c --- /dev/null +++ b/src/Monify.Console.Tests/Records/Simple/SimpleForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Records.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + string actual = subject.ToString(); + + // Assert + actual.ShouldBe("SimpleForImmutableArray { }"); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..62453dc --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..a576a79 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..59942d8 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..0ec3a20 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..2e00ee9 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new OutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + Action act = () => subject.Equals(other); + + // Assert + _ = Should.Throw(act); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..e847cfe --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..2c2738d --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..7a9bffe --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..64378ef --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..4ef8f4a --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..683e400 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..9e02ccf --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,22 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly string Expected = $"Inner {{ {typeof(ImmutableArray)} }}"; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string result = subject.ToString(); + + // Assert + result.ShouldBe(Expected); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..ec25ecd --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + IOutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..d58d223 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithIOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner? left = default; + IOutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner? left = default; + IOutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + IOutterForImmutableArray.Inner left = new(leftValues); + IOutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..df0485b --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithIOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithIOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..b0a9926 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithIOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithIOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..b3db7ee --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..d0a0981 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentIOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new IOutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + Action act = () => subject.Equals(other); + + // Assert + _ = Should.Throw(act); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..311eb59 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + IOutterForImmutableArray.Inner first = new(_firstValue); + IOutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + IOutterForImmutableArray.Inner first = new(_firstValue); + IOutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..d1ca3d2 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + IOutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..eb2b035 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..9c623c7 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithIOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithIOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + IOutterForImmutableArray.Inner left = new(leftValues); + IOutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner left = new(_sampleValue); + IOutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..efe480f --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..6b2fbc6 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,22 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly string Expected = $"Inner {{ {typeof(ImmutableArray)} }}"; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + IOutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string result = subject.ToString(); + + // Assert + result.ShouldBe(Expected); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..452ba4c --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..81808a4 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..dadfa32 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..cb8c436 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..b81d861 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new OutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + Action act = () => subject.Equals(other); + + // Assert + _ = Should.Throw(act); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..2b8d92e --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..f689dd0 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..307c84c --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..b7140e9 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..1d560e0 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..53ca4c7 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..7c04009 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,22 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly string Expected = $"Inner {{ {typeof(ImmutableArray)} }}"; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string result = subject.ToString(); + + // Assert + result.ShouldBe(Expected); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..75391b5 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..ec42013 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..758e8a3 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..20a3e3e --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..66fb046 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new OutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + Action act = () => subject.Equals(other); + + // Assert + _ = Should.Throw(act); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..8fbb353 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..e36d33e --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..f74b84e --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..229bb36 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..b30cfa0 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..6dbb068 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..fd51393 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,22 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly string Expected = $"Inner {{ {typeof(ImmutableArray)} }}"; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string result = subject.ToString(); + + // Assert + result.ShouldBe(Expected); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..6f11b4d --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForImmutableArray.Inner instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..9f33566 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..6a8b56a --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner? left = default; + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..0b5cb46 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..5a826df --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForImmutableArrayInnerThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = new OutterForImmutableArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + object other = string.Empty; + + // Act + Action act = () => subject.Equals(other); + + // Assert + _ = Should.Throw(act); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..51da5f5 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenEqualsWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..dd3b21e --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForImmutableArray.Inner first = new(_firstValue); + OutterForImmutableArray.Inner second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..edc1f7e --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForImmutableArray.Inner result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..2da0e75 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..0e4fd8a --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs new file mode 100644 index 0000000..5c47b80 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithOutterForImmutableArrayInnerIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + OutterForImmutableArray.Inner left = new(leftValues); + OutterForImmutableArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForImmutableArray.Inner left = new(_sampleValue); + OutterForImmutableArray.Inner right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..25d4c1e --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,22 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly string Expected = $"Inner {{ {typeof(ImmutableArray)} }}"; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForImmutableArray.Inner subject = new(_sampleValue); + + // Act + string result = subject.ToString(); + + // Assert + result.ShouldBe(Expected); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..86b2d20 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenConstructorIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + SimpleForImmutableArray instance = new(_sampleValue); + + // Act + ImmutableArray actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..54b25ed --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Structs.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + SimpleForImmutableArray? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject == _differentValue; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithSimpleForImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithSimpleForImmutableArrayIsCalled.cs new file mode 100644 index 0000000..c759638 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualityOperatorWithSimpleForImmutableArrayIsCalled.cs @@ -0,0 +1,81 @@ +namespace Monify.Console.Structs.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualityOperatorWithSimpleForImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + SimpleForImmutableArray? left = default; + SimpleForImmutableArray? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + SimpleForImmutableArray? left = default; + SimpleForImmutableArray right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + SimpleForImmutableArray left = new(leftValues); + SimpleForImmutableArray right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_differentValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..c5834b4 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualsWithImmutableArrayIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_differentValue); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..bcc8ac6 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,49 @@ +namespace Monify.Console.Structs.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentSimpleForImmutableArrayThenReturnTrue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + object other = new SimpleForImmutableArray(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + object other = string.Empty; + + // Act + Action act = () => subject.Equals(other); + + // Assert + _ = Should.Throw(act); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualsWithSimpleForImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualsWithSimpleForImmutableArrayIsCalled.cs new file mode 100644 index 0000000..2478fa6 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenEqualsWithSimpleForImmutableArrayIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenEqualsWithSimpleForImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_differentValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeFalse(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..20e0e7d --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,39 @@ +namespace Monify.Console.Structs.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly ImmutableArray _firstValue = ["Eta", "Theta", "Iota"]; + private static readonly ImmutableArray _secondValue = ["Kappa", "Lambda", "Mu"]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + SimpleForImmutableArray first = new(_firstValue); + SimpleForImmutableArray second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + SimpleForImmutableArray first = new(_firstValue); + SimpleForImmutableArray second = new(_secondValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldNotBe(secondHash); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs new file mode 100644 index 0000000..d3fa855 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorFromImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorFromImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + SimpleForImmutableArray result = _sampleValue; + + // Act + ImmutableArray actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs new file mode 100644 index 0000000..8adec7d --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenImplicitOperatorToImmutableArrayIsCalled.cs @@ -0,0 +1,21 @@ +namespace Monify.Console.Structs.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenImplicitOperatorToImmutableArrayIsCalled +{ + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + ImmutableArray actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs new file mode 100644 index 0000000..7474c80 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithImmutableArrayIsCalled.cs @@ -0,0 +1,48 @@ +namespace Monify.Console.Structs.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + SimpleForImmutableArray? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + bool actual = subject != _differentValue; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithSimpleForImmutableArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithSimpleForImmutableArrayIsCalled.cs new file mode 100644 index 0000000..731065f --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenInequalityOperatorWithSimpleForImmutableArrayIsCalled.cs @@ -0,0 +1,53 @@ +namespace Monify.Console.Structs.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenInequalityOperatorWithSimpleForImmutableArrayIsCalled +{ + private static readonly ImmutableArray _differentValue = ["Delta", "Epsilon", "Zeta"]; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + ImmutableArray leftValues = ["Alpha", "Beta", "Gamma"]; + ImmutableArray rightValues = ["Alpha", "Beta", "Gamma"]; + SimpleForImmutableArray left = new(leftValues); + SimpleForImmutableArray right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + SimpleForImmutableArray left = new(_sampleValue); + SimpleForImmutableArray right = new(_differentValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..ee04e9f --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Simple/SimpleForImmutableArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,22 @@ +namespace Monify.Console.Structs.Simple.SimpleForImmutableArrayTests; + +using System.Collections.Immutable; + +public static class WhenToStringIsCalled +{ + private static readonly string Expected = $"SimpleForImmutableArray {{ {typeof(ImmutableArray)} }}"; + private static readonly ImmutableArray _sampleValue = ["Alpha", "Beta", "Gamma"]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + SimpleForImmutableArray subject = new(_sampleValue); + + // Act + string result = subject.ToString(); + + // Assert + result.ShouldBe(Expected); + } +} \ No newline at end of file diff --git a/src/Monify.Console/Classes/Nested/InClass/OutterForImmutableArray.{T}.cs b/src/Monify.Console/Classes/Nested/InClass/OutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..5782ed9 --- /dev/null +++ b/src/Monify.Console/Classes/Nested/InClass/OutterForImmutableArray.{T}.cs @@ -0,0 +1,16 @@ +namespace Monify.Console.Classes.Nested.InClass; + +using System.Collections.Immutable; + +/// +/// Provides a nested class example that uses Monify with immutable array of string types. +/// +/// The class type that the outer class is parameterized with. +public sealed partial class OutterForImmutableArray +{ + /// + /// Represents the inner class decorated by Monify for immutable array of string types. + /// + [Monify>] + public sealed partial class Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Classes/Nested/InInterface/IOutterForImmutableArray.{T}.cs b/src/Monify.Console/Classes/Nested/InInterface/IOutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..4af2295 --- /dev/null +++ b/src/Monify.Console/Classes/Nested/InInterface/IOutterForImmutableArray.{T}.cs @@ -0,0 +1,17 @@ +namespace Monify.Console.Classes.Nested.InInterface; + +using System.Collections.Immutable; + +/// +/// Provides a nested interface example that uses Monify with immutable array of string types. +/// +/// The struct type that the interface is parameterized with. +public partial interface IOutterForImmutableArray + where T : struct +{ + /// + /// Represents the inner class decorated by Monify for immutable array of string types. + /// + [Monify>] + public sealed partial class Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Classes/Nested/InRecord/OutterForImmutableArray.{T}.cs b/src/Monify.Console/Classes/Nested/InRecord/OutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..7ba534b --- /dev/null +++ b/src/Monify.Console/Classes/Nested/InRecord/OutterForImmutableArray.{T}.cs @@ -0,0 +1,16 @@ +namespace Monify.Console.Classes.Nested.InRecord; + +using System.Collections.Immutable; + +/// +/// Provides a nested record example that uses Monify with immutable array of string types. +/// +/// The record type that the outer record is parameterized with. +public sealed partial record OutterForImmutableArray +{ + /// + /// Represents the inner class decorated by Monify for immutable array of string types. + /// + [Monify>] + public sealed partial class Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Classes/Nested/InRecordStruct/OutterForImmutableArray.{T}.cs b/src/Monify.Console/Classes/Nested/InRecordStruct/OutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..6a85fb9 --- /dev/null +++ b/src/Monify.Console/Classes/Nested/InRecordStruct/OutterForImmutableArray.{T}.cs @@ -0,0 +1,16 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct; + +using System.Collections.Immutable; + +/// +/// Provides a nested record struct example that uses Monify with immutable array of string types. +/// +/// The record struct type that the outer record struct is parameterized with. +public readonly partial record struct OutterForImmutableArray +{ + /// + /// Represents the inner class decorated by Monify for immutable array of string types. + /// + [Monify>] + public sealed partial class Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Classes/Nested/InStruct/OutterForImmutableArray.{T}.cs b/src/Monify.Console/Classes/Nested/InStruct/OutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..e81b65f --- /dev/null +++ b/src/Monify.Console/Classes/Nested/InStruct/OutterForImmutableArray.{T}.cs @@ -0,0 +1,17 @@ +namespace Monify.Console.Classes.Nested.InStruct; + +using System.Collections.Immutable; + +/// +/// Provides a nested struct example that uses Monify with immutable array of string types. +/// +/// The struct type that the outer struct is parameterized with. +public readonly ref partial struct OutterForImmutableArray + where T : struct +{ + /// + /// Represents the inner class decorated by Monify for immutable array of string types. + /// + [Monify>] + public sealed partial class Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Classes/Simple/SimpleForImmutableArray.cs b/src/Monify.Console/Classes/Simple/SimpleForImmutableArray.cs new file mode 100644 index 0000000..8d4aae9 --- /dev/null +++ b/src/Monify.Console/Classes/Simple/SimpleForImmutableArray.cs @@ -0,0 +1,9 @@ +namespace Monify.Console.Classes.Simple; + +using System.Collections.Immutable; + +/// +/// Represents a simple class decorated by Monify for immutable array of string types. +/// +[Monify>] +public partial class SimpleForImmutableArray; \ No newline at end of file diff --git a/src/Monify.Console/Records/Nested/InClass/OutterForImmutableArray.{T}.cs b/src/Monify.Console/Records/Nested/InClass/OutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..53e3b52 --- /dev/null +++ b/src/Monify.Console/Records/Nested/InClass/OutterForImmutableArray.{T}.cs @@ -0,0 +1,16 @@ +namespace Monify.Console.Records.Nested.InClass; + +using System.Collections.Immutable; + +/// +/// Provides a nested class example that uses Monify with immutable array of string types. +/// +/// The class type that the outer class is parameterized with. +public sealed partial class OutterForImmutableArray +{ + /// + /// Represents the inner record decorated by Monify for immutable array of string types. + /// + [Monify>] + public sealed partial record Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Records/Nested/InInterface/IOutterForImmutableArray.{T}.cs b/src/Monify.Console/Records/Nested/InInterface/IOutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..9b4d815 --- /dev/null +++ b/src/Monify.Console/Records/Nested/InInterface/IOutterForImmutableArray.{T}.cs @@ -0,0 +1,17 @@ +namespace Monify.Console.Records.Nested.InInterface; + +using System.Collections.Immutable; + +/// +/// Provides a nested interface example that uses Monify with immutable array of string types. +/// +/// The struct type that the interface is parameterized with. +public partial interface IOutterForImmutableArray + where T : struct +{ + /// + /// Represents the inner record decorated by Monify for immutable array of string types. + /// + [Monify>] + public sealed partial record Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Records/Nested/InRecord/OutterForImmutableArray.{T}.cs b/src/Monify.Console/Records/Nested/InRecord/OutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..c1d0cab --- /dev/null +++ b/src/Monify.Console/Records/Nested/InRecord/OutterForImmutableArray.{T}.cs @@ -0,0 +1,16 @@ +namespace Monify.Console.Records.Nested.InRecord; + +using System.Collections.Immutable; + +/// +/// Provides a nested record example that uses Monify with immutable array of string types. +/// +/// The record type that the outer record is parameterized with. +public sealed partial record OutterForImmutableArray +{ + /// + /// Represents the inner record decorated by Monify for immutable array of string types. + /// + [Monify>] + public sealed partial record Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Records/Nested/InRecordStruct/OutterForImmutableArray.{T}.cs b/src/Monify.Console/Records/Nested/InRecordStruct/OutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..3242027 --- /dev/null +++ b/src/Monify.Console/Records/Nested/InRecordStruct/OutterForImmutableArray.{T}.cs @@ -0,0 +1,16 @@ +namespace Monify.Console.Records.Nested.InRecordStruct; + +using System.Collections.Immutable; + +/// +/// Provides a nested record struct example that uses Monify with immutable array of string types. +/// +/// The record struct type that the outer record struct is parameterized with. +public readonly partial record struct OutterForImmutableArray +{ + /// + /// Represents the inner record decorated by Monify for immutable array of string types. + /// + [Monify>] + public sealed partial record Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Records/Nested/InStruct/OutterForImmutableArray.{T}.cs b/src/Monify.Console/Records/Nested/InStruct/OutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..d7514a4 --- /dev/null +++ b/src/Monify.Console/Records/Nested/InStruct/OutterForImmutableArray.{T}.cs @@ -0,0 +1,17 @@ +namespace Monify.Console.Records.Nested.InStruct; + +using System.Collections.Immutable; + +/// +/// Provides a nested struct example that uses Monify with immutable array of string types. +/// +/// The struct type that the outer struct is parameterized with. +public readonly ref partial struct OutterForImmutableArray + where T : struct +{ + /// + /// Represents the inner record decorated by Monify for immutable array of string types. + /// + [Monify>] + public sealed partial record Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Records/Simple/SimpleForImmutableArray.cs b/src/Monify.Console/Records/Simple/SimpleForImmutableArray.cs new file mode 100644 index 0000000..1dd50f0 --- /dev/null +++ b/src/Monify.Console/Records/Simple/SimpleForImmutableArray.cs @@ -0,0 +1,9 @@ +namespace Monify.Console.Records.Simple; + +using System.Collections.Immutable; + +/// +/// Represents a simple record decorated by Monify for immutable array of string types. +/// +[Monify>] +public partial record SimpleForImmutableArray; \ No newline at end of file diff --git a/src/Monify.Console/Structs/Nested/InClass/OutterForImmutableArray.{T}.cs b/src/Monify.Console/Structs/Nested/InClass/OutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..6de1e13 --- /dev/null +++ b/src/Monify.Console/Structs/Nested/InClass/OutterForImmutableArray.{T}.cs @@ -0,0 +1,16 @@ +namespace Monify.Console.Structs.Nested.InClass; + +using System.Collections.Immutable; + +/// +/// Provides a nested class example that uses Monify with immutable array of string types. +/// +/// The class type that the outer class is parameterized with. +public sealed partial class OutterForImmutableArray +{ + /// + /// Represents the inner struct decorated by Monify for immutable array of string types. + /// + [Monify>] + public readonly partial struct Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Structs/Nested/InInterface/IOutterForImmutableArray.{T}.cs b/src/Monify.Console/Structs/Nested/InInterface/IOutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..dbd66eb --- /dev/null +++ b/src/Monify.Console/Structs/Nested/InInterface/IOutterForImmutableArray.{T}.cs @@ -0,0 +1,17 @@ +namespace Monify.Console.Structs.Nested.InInterface; + +using System.Collections.Immutable; + +/// +/// Provides a nested interface example that uses Monify with immutable array of string types. +/// +/// The struct type that the interface is parameterized with. +public partial interface IOutterForImmutableArray + where T : struct +{ + /// + /// Represents the inner struct decorated by Monify for immutable array of string types. + /// + [Monify>] + public readonly partial struct Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Structs/Nested/InRecord/OutterForImmutableArray.{T}.cs b/src/Monify.Console/Structs/Nested/InRecord/OutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..1155352 --- /dev/null +++ b/src/Monify.Console/Structs/Nested/InRecord/OutterForImmutableArray.{T}.cs @@ -0,0 +1,16 @@ +namespace Monify.Console.Structs.Nested.InRecord; + +using System.Collections.Immutable; + +/// +/// Provides a nested record example that uses Monify with immutable array of string types. +/// +/// The record type that the outer record is parameterized with. +public sealed partial record OutterForImmutableArray +{ + /// + /// Represents the inner struct decorated by Monify for immutable array of string types. + /// + [Monify>] + public readonly partial struct Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Structs/Nested/InRecordStruct/OutterForImmutableArray.{T}.cs b/src/Monify.Console/Structs/Nested/InRecordStruct/OutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..e17975c --- /dev/null +++ b/src/Monify.Console/Structs/Nested/InRecordStruct/OutterForImmutableArray.{T}.cs @@ -0,0 +1,16 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct; + +using System.Collections.Immutable; + +/// +/// Provides a nested record struct example that uses Monify with immutable array of string types. +/// +/// The record struct type that the outer record struct is parameterized with. +public readonly partial record struct OutterForImmutableArray +{ + /// + /// Represents the inner struct decorated by Monify for immutable array of string types. + /// + [Monify>] + public readonly partial struct Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Structs/Nested/InStruct/OutterForImmutableArray.{T}.cs b/src/Monify.Console/Structs/Nested/InStruct/OutterForImmutableArray.{T}.cs new file mode 100644 index 0000000..f7d274d --- /dev/null +++ b/src/Monify.Console/Structs/Nested/InStruct/OutterForImmutableArray.{T}.cs @@ -0,0 +1,17 @@ +namespace Monify.Console.Structs.Nested.InStruct; + +using System.Collections.Immutable; + +/// +/// Provides a nested struct example that uses Monify with immutable array of string types. +/// +/// The struct type that the outer struct is parameterized with. +public readonly ref partial struct OutterForImmutableArray + where T : struct +{ + /// + /// Represents the inner struct decorated by Monify for immutable array of string types. + /// + [Monify>] + public readonly partial struct Inner; +} \ No newline at end of file diff --git a/src/Monify.Console/Structs/Simple/SimpleForImmutableArray.cs b/src/Monify.Console/Structs/Simple/SimpleForImmutableArray.cs new file mode 100644 index 0000000..0d77632 --- /dev/null +++ b/src/Monify.Console/Structs/Simple/SimpleForImmutableArray.cs @@ -0,0 +1,9 @@ +namespace Monify.Console.Structs.Simple; + +using System.Collections.Immutable; + +/// +/// Represents a simple struct decorated by Monify for immutable array of string types. +/// +[Monify>] +public readonly partial struct SimpleForImmutableArray; \ No newline at end of file