diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 4013db0..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 68f1b94..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index f70b43a..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index 179e8e7..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 265b9d3..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - object other = new OutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 02aa82b..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index b99f254..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index 7ebcda0..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index 139a577..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - Action act = () => _ = (int[])subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 35bc3d4..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 718da1b..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index da96198..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { System.Int32[] }"; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForArray.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/InClass/OutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..1ed460c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..222798d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..7ed83b4 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..d45414e --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..9804cc9 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + object other = new OutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..25910c2 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualsWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..0775045 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.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/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..0917c5e --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..e894fbf --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + Action act = () => _ = (int[])subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..3a31d4a --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..8e3d20f --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests; + +public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..eaef174 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { System.Int32[] }"; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForArray.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/InClass/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 9994343..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index 94df7f3..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index ff575ca..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index 6c28f44..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index fc04672..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForIntInnerThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - object other = new OutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index eeefec9..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index f9ea02a..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index f000a07..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index af030ea..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - Action act = () => _ = (int)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index 8a5e808..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index dc516fb..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 4ca6fb8..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { 42 }"; - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenTheExpectedStringIsReturned() - { - // Arrange - OutterForInt.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/InClass/OutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..671b353 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..084b1aa --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..85d8a4c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests; + +public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..1145d64 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..13a34dc --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForIntInnerThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + object other = new OutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..4808519 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests; + +public static class WhenEqualsWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..c6d95f3 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.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/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..8d82f86 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..ac6854c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + Action act = () => _ = (int)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..8a60df0 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..f7083f6 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests; + +public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..5313eb1 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { 42 }"; + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenTheExpectedStringIsReturned() + { + // Arrange + OutterForInt.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/InClass/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 75c0690..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 0ddb777..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index e1d3385..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 95fba45..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForStringInnerThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - object other = new OutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 4153265..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index 815590d..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 351f276..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index 8dd9aa7..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index ddfa059..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - Action act = () => _ = (string)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index fe2efed..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index ee26aca..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 3db4579..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = $"Inner {{ {SampleValue} }}"; - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForString.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/InClass/OutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..681675d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..89f7f1c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests; + +public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..9d0d4c9 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..bd5f698 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForStringInnerThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + object other = new OutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..dbb1ded --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests; + +public static class WhenEqualsWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..c2e740a --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..b59b59f --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.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/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..62ae177 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..65f1892 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + Action act = () => _ = (string)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..ef6fa3c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests; + +public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..cd220fd --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..a997572 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InClass/OutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InClass.OutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = $"Inner {{ {SampleValue} }}"; + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForString.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/IOutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index db29dcf..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - IOutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs deleted file mode 100644 index db04440..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - IOutterForArray.Inner? left = default; - IOutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - IOutterForArray.Inner? left = default; - IOutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - IOutterForArray.Inner left = new(leftValues); - IOutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index dc3b71b..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - IOutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 7352bda..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index bd0efc2..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 9b38db1..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentIOutterForArrayInnerThenReturnTrue() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - object other = new IOutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 630356f..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - IOutterForArray.Inner first = new(_firstValue); - IOutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - IOutterForArray.Inner first = new(_firstValue); - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index a2396a7..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - IOutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index 6e1a2af..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - IOutterForArray.Inner? subject = default; - - // Act - Action act = () => _ = (int[])subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs deleted file mode 100644 index e0581b8..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - IOutterForArray.Inner left = new(leftValues); - IOutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 3fe0d74..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - IOutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index d5e4a6f..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { System.Int32[] }"; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..b12a038 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + IOutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..24b9d8c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualityOperatorWithIOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + IOutterForArray.Inner? left = default; + IOutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + IOutterForArray.Inner? left = default; + IOutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + IOutterForArray.Inner left = new(leftValues); + IOutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.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/IOutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..863552b --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + IOutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForArray.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/IOutterForArrayTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..53801b0 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualsWithIOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.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/IOutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..9d9125b --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForArray.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/IOutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..ce5338d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentIOutterForArrayInnerThenReturnTrue() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + object other = new IOutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + IOutterForArray.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/IOutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..3fd0260 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + IOutterForArray.Inner first = new(_firstValue); + IOutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + IOutterForArray.Inner first = new(_firstValue); + IOutterForArray.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/IOutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..12edef7 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + IOutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..51e0ee8 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + IOutterForArray.Inner? subject = default; + + // Act + Action act = () => _ = (int[])subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..983ec05 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests; + +public static class WhenInequalityOperatorWithIOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + IOutterForArray.Inner left = new(leftValues); + IOutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.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/IOutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..36cd5c2 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + IOutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + IOutterForArray.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/IOutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..ce5b910 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { System.Int32[] }"; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + IOutterForArray.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/IOutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index aeaac01..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - IOutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs deleted file mode 100644 index 8bf48b9..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - IOutterForInt.Inner? left = default; - IOutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - IOutterForInt.Inner? left = default; - IOutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index 22b819e..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - IOutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs deleted file mode 100644 index dc5e2b1..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualsWithIOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index 258c1f9..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 895828e..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentIOutterForIntInnerThenReturnTrue() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - object other = new IOutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index b5c41c3..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - IOutterForInt.Inner first = new(FirstValue); - IOutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - IOutterForInt.Inner first = new(FirstValue); - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index fd137f9..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - IOutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index 75df0df..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - IOutterForInt.Inner? subject = default; - - // Act - Action act = () => _ = (int)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs deleted file mode 100644 index fa28392..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index efd89d4..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - IOutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 3f39b87..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { 42 }"; - private const int SampleValue = 42; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..4511330 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + IOutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..bef600b --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualityOperatorWithIOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + IOutterForInt.Inner? left = default; + IOutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + IOutterForInt.Inner? left = default; + IOutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.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/IOutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..50ed275 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + IOutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForInt.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/IOutterForIntTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..e34ff93 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualsWithIOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.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/IOutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..ba2c9a5 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForInt.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/IOutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..d8c15c6 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentIOutterForIntInnerThenReturnTrue() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + object other = new IOutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + IOutterForInt.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/IOutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..fd6691c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + IOutterForInt.Inner first = new(FirstValue); + IOutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + IOutterForInt.Inner first = new(FirstValue); + IOutterForInt.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/IOutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..0307431 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + IOutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..9ca7e47 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + IOutterForInt.Inner? subject = default; + + // Act + Action act = () => _ = (int)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..be0ba99 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests; + +public static class WhenInequalityOperatorWithIOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.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/IOutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..9ab2a2b --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + IOutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + IOutterForInt.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/IOutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..b98bf41 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { 42 }"; + private const int SampleValue = 42; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + IOutterForInt.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/IOutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 9a353f2..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - IOutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs deleted file mode 100644 index ff86dc6..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithIOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - IOutterForString.Inner? left = default; - IOutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - IOutterForString.Inner? left = default; - IOutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - IOutterForString.Inner left = new(leftValue); - IOutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.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/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index 04c7b95..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - IOutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - IOutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForString.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/IOutterForStringTests/InnerTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs deleted file mode 100644 index 2873bd1..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualsWithIOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.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/IOutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index def40d9..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentIOutterForStringInnerThenReturnTrue() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - object other = new IOutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - IOutterForString.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/IOutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index 758affa..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForString.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/IOutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index da26ec1..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - IOutterForString.Inner first = new(FirstValue); - IOutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - IOutterForString.Inner first = new(FirstValue); - IOutterForString.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/IOutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index d834dfb..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - IOutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index 931ef44..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - IOutterForString.Inner? subject = default; - - // Act - Action act = () => _ = (string)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs deleted file mode 100644 index a80e8aa..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithIOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - IOutterForString.Inner left = new(leftValue); - IOutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.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/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index ffb23a9..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - IOutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - IOutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - IOutterForString.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/IOutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 9400901..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = $"Inner {{ {SampleValue} }}"; - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - IOutterForString.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/IOutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..48171fc --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + IOutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..e3614e1 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualityOperatorWithIOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + IOutterForString.Inner? left = default; + IOutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + IOutterForString.Inner? left = default; + IOutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + IOutterForString.Inner left = new(leftValue); + IOutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.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/IOutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..822e15f --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + IOutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + IOutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForString.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/IOutterForStringTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..0aa53a8 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualsWithIOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.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/IOutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..26c36ad --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentIOutterForStringInnerThenReturnTrue() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + object other = new IOutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + IOutterForString.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/IOutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..483e1b5 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForString.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/IOutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..b128128 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + IOutterForString.Inner first = new(FirstValue); + IOutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + IOutterForString.Inner first = new(FirstValue); + IOutterForString.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/IOutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..5c5665d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + IOutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..ae01030 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + IOutterForString.Inner? subject = default; + + // Act + Action act = () => _ = (string)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..c2e1c97 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests; + +public static class WhenInequalityOperatorWithIOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + IOutterForString.Inner left = new(leftValue); + IOutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.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/IOutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..3085da2 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + IOutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + IOutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + IOutterForString.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/IOutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..ef0c606 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InInterface/IOutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InInterface.IOutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = $"Inner {{ {SampleValue} }}"; + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + IOutterForString.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/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 2b40d88..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index b3e48a8..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 28b9db6..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index 2483409..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index edc6324..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - object other = new OutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index bd4369c..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index bbc12d1..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index efe939c..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index a6f7698..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - Action act = () => _ = (int[])subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 0842dee..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 0a0f2c1..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 467ace2..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { System.Int32[] }"; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForArray.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/OutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..139432e --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..c34c94d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..12a83ad --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..e6fe1b0 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..bb2b733 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + object other = new OutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..b8bc837 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualsWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..54c357e --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.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/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..e1c18e7 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..e38b4d3 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + Action act = () => _ = (int[])subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..8b56711 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..d17796c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests; + +public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..666180b --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { System.Int32[] }"; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForArray.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/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index af978f9..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index 7c40a36..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index a9cc255..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index 7156b8c..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index fa4d6b8..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForIntInnerThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - object other = new OutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 3d454dd..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index dba8c77..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index 358e331..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index dc6ec60..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - Action act = () => _ = (int)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index 0d8d0f4..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 5174329..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 2080306..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { 42 }"; - private const int SampleValue = 42; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForInt.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/OutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..7a0b5be --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..7bd9f95 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..e4ce0f4 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..24340a9 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..fa9bfab --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForIntInnerThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + object other = new OutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..459d986 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualsWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..a0112a2 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.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/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..227582f --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..5667147 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + Action act = () => _ = (int)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..eb8ae27 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..e39f15f --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests; + +public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..ec82150 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { 42 }"; + private const int SampleValue = 42; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForInt.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/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 04049d8..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 90d374c..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index 0606738..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index ce307c6..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForStringInnerThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - object other = new OutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 43cb2fe..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index aa05d4a..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 0069e02..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index 97c1964..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index 4f98de8..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - Action act = () => _ = (string)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index c374954..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index 05b6cf3..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 773cdb6..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = $"Inner {{ {SampleValue} }}"; - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForString.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/OutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..4a9cf4f --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..a0a6255 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..b39fb73 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..fc10917 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForStringInnerThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + object other = new OutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..318260b --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualsWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..2dd8ea3 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..2409d4f --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.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/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..7048edf --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..a2553be --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + Action act = () => _ = (string)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..209103d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests; + +public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..ae2afae --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..d9257fd --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecord/OutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InRecord.OutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = $"Inner {{ {SampleValue} }}"; + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForString.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/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index e43d707..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 9d7bcd0..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index d15f44f..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index a9d097b..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 066d9f6..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - object other = new OutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 6c29fc5..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index f1c40a1..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index af0c15d..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index adf8961..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - Action act = () => _ = (int[])subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 2b82276..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 06a865a..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 5cfae1b..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { System.Int32[] }"; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForArray.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/OutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..a43dabc --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..ffa5fb8 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..422eca5 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..fbcfc4d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..886091f --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + object other = new OutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..b069c15 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualsWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..aa334ab --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.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/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..8fe2528 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..df6d944 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + Action act = () => _ = (int[])subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..a3eb37b --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..468b755 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..9842d19 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { System.Int32[] }"; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForArray.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/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index f707c95..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index 9993c11..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 50a7ce1..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index 660487f..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 35a7a58..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForIntInnerThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - object other = new OutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 603539a..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index ffdd74e..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index 57aebd2..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index 98dad76..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - Action act = () => _ = (int)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index 89d8131..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index d8a9ea8..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index d24947f..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { 42 }"; - private const int SampleValue = 42; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForInt.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/OutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..c0d02a1 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..2b149de --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..c420d7a --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..80ea8b2 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..a21c0fa --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForIntInnerThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + object other = new OutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..c151f8e --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualsWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..7669d47 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.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/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..67257ad --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..4bf988c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + Action act = () => _ = (int)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..061c5c4 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..3ea6dd1 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..c2fbca9 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { 42 }"; + private const int SampleValue = 42; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForInt.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/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 4cdad6a..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 660b73d..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index 3ea812c..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 69e0e98..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForStringInnerThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - object other = new OutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index d8e03b9..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index 0b4c724..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 08a1ac9..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index 99ee5a7..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index 0ff4e00..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - Action act = () => _ = (string)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 9614155..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index 2061d82..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 72b0122..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = $"Inner {{ {SampleValue} }}"; - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForString.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/OutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..80d18b7 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..217a8e7 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..5dd325c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..53cee1d --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForStringInnerThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + object other = new OutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..341e4db --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualsWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..a9828af --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..fdffe10 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.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/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..c3720c7 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..d1c4b0f --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + Action act = () => _ = (string)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..fd65973 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..88a8562 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..f27be4c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InRecordStruct/OutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = $"Inner {{ {SampleValue} }}"; + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForString.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/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index da2d0f4..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index ba6991b..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index a12f5ce..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index 54b46e4..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 5fb9ad7..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - object other = new OutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index e4f3385..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index b8bdd30..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index affa79b..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index 022106d..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - Action act = () => _ = (int[])subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 5cd6430..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 6f2ebd8..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index f9a4719..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { System.Int32[] }"; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForArray.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/OutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..b17838a --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..441fd79 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..3ddf8a6 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..23eff74 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..c92b222 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + object other = new OutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..cce3bc4 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualsWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..ef6835e --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.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/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..8bb1489 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..f4171c5 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + Action act = () => _ = (int[])subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..f2c381c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..bc4e3ca --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests; + +public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..605e90c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { System.Int32[] }"; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForArray.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/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 0635ab3..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index 2cd1402..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 30b12ce..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index 091f82d..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 7d231b0..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForIntInnerThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - object other = new OutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 8aaecc4..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index d86cded..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index 8cfcb02..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index 14e7572..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - Action act = () => _ = (int)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index bef40d6..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index a0ff6cf..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index e8f31d9..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { 42 }"; - private const int SampleValue = 42; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForInt.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/OutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..caab433 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..6adbf30 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..cf649d3 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..2492a3f --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..2c24702 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForIntInnerThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + object other = new OutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..523764c --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualsWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..fa0af97 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.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/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..7e8302a --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..be98734 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + Action act = () => _ = (int)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..7344d60 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..bc4f632 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests; + +public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..2bda27a --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { 42 }"; + private const int SampleValue = 42; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForInt.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/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index fe623e8..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 8ae112d..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index fe00589..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index aa87016..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForStringInnerThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - object other = new OutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 47b425d..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index d1a7055..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 02e5c50..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index c71d874..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index a6df8c0..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - Action act = () => _ = (string)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index ee2fedb..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index 57c4587..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 4687ca9..0000000 --- a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = $"Inner {{ {SampleValue} }}"; - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForString.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/OutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..d2ad5fc --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..2774d00 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..53194c6 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..7e57eb7 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForStringInnerThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + object other = new OutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..54957c9 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualsWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..6a2feb5 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..1eea965 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.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/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..f1db47a --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..ecc2ef2 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + Action act = () => _ = (string)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..967ac88 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests; + +public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..f0e04dc --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..b8a7080 --- /dev/null +++ b/src/Monify.Console.Tests/Classes/Nested/InStruct/OutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Classes.Nested.InStruct.OutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = $"Inner {{ {SampleValue} }}"; + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForString.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/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index e07fc3d..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 7b1faea..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index fd5f10e..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index 5f65afe..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index d01b44e..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - object other = new OutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index acc71f6..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 8ab75d9..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index dd18ba2..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index 7000f18..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - Action act = () => _ = (int[])subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index d3296ea..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 24c2f9f..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 21d81df..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - OutterForArray.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/InClass/OutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..6c17b1f --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..7b3c739 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..1d2f532 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..725b78b --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..ff211a4 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + object other = new OutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..8945ab2 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualsWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..ddedc3a --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.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/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..0294ea9 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..4a37b41 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + Action act = () => _ = (int[])subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..e0e8b6c --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..e456a0f --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests; + +public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..5bb1d5b --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForArray.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/InClass/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index b3e7df6..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index acfcc6f..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 2483b07..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index 636c75e..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 3c8b6d5..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForIntInnerThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - object other = new OutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 7122570..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 209b4db..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index dab146f..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index 2791ca3..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - Action act = () => _ = (int)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index 70a5c13..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 34a4169..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index c5f775d..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - OutterForInt.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/InClass/OutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..ad15ef0 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..012a354 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..62d9574 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForIntTests; + +public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..f3bed8f --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..c1a3bd9 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForIntInnerThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + object other = new OutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..16be97b --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForIntTests; + +public static class WhenEqualsWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..df9baf8 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.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/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..d90d4a1 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..1c74126 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + Action act = () => _ = (int)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..b338a4a --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..3b15445 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForIntTests; + +public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..c2b7385 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForInt.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/InClass/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 359f93d..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 2f89f44..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index 034dcbd..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 8bf79b9..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForStringInnerThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - object other = new OutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 9273761..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index c6e9f96..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index c952794..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index 1c78b24..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index a903a21..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - Action act = () => _ = (string)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 28493d1..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index 3bee6bc..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 1130488..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - OutterForString.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/InClass/OutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..d6f9abd --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..841ff82 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForStringTests; + +public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..196019b --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..17dd8d9 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForStringInnerThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + object other = new OutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..4ceffeb --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForStringTests; + +public static class WhenEqualsWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..c6cc8ca --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..9d84d93 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.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/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..6ce709e --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..9fa4803 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + Action act = () => _ = (string)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..b076889 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForStringTests; + +public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..4829195 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..0a3876d --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InClass/OutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InClass.OutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForString.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/IOutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 6473226..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - IOutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 749c493..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - IOutterForArray.Inner? left = default; - IOutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - IOutterForArray.Inner? left = default; - IOutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - IOutterForArray.Inner left = new(leftValues); - IOutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 7740b0c..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - IOutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 2433eba..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index 2dde2c8..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 305383c..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentIOutterForArrayInnerThenReturnTrue() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - object other = new IOutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 7a50981..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - IOutterForArray.Inner first = new(_firstValue); - IOutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - IOutterForArray.Inner first = new(_firstValue); - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index b5591df..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - IOutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index 8ed5412..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - IOutterForArray.Inner? subject = default; - - // Act - Action act = () => _ = (int[])subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs deleted file mode 100644 index a85e597..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - IOutterForArray.Inner left = new(leftValues); - IOutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index d43788c..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - IOutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index a71e0b4..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..7fd9358 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + IOutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..c470ebd --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualityOperatorWithIOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + IOutterForArray.Inner? left = default; + IOutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + IOutterForArray.Inner? left = default; + IOutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + IOutterForArray.Inner left = new(leftValues); + IOutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.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/IOutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..008b108 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + IOutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForArray.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/IOutterForArrayTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..a1323fc --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualsWithIOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.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/IOutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..c2c4d05 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForArray.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/IOutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..d47ea93 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentIOutterForArrayInnerThenReturnTrue() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + object other = new IOutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + IOutterForArray.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/IOutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..4fa5eb4 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + IOutterForArray.Inner first = new(_firstValue); + IOutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + IOutterForArray.Inner first = new(_firstValue); + IOutterForArray.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/IOutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..eb7ba2a --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + IOutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..e28f40b --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + IOutterForArray.Inner? subject = default; + + // Act + Action act = () => _ = (int[])subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..e95eb00 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests; + +public static class WhenInequalityOperatorWithIOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + IOutterForArray.Inner left = new(leftValues); + IOutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.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/IOutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..d478bd8 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + IOutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + IOutterForArray.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/IOutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..1c94238 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + IOutterForArray.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/IOutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 35ce23f..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - IOutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs deleted file mode 100644 index 38235f5..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - IOutterForInt.Inner? left = default; - IOutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - IOutterForInt.Inner? left = default; - IOutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index fdd9206..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - IOutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs deleted file mode 100644 index 58f5397..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualsWithIOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index 6a3fc7f..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index aa142c6..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentIOutterForIntInnerThenReturnTrue() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - object other = new IOutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index bff2635..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - IOutterForInt.Inner first = new(FirstValue); - IOutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - IOutterForInt.Inner first = new(FirstValue); - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index 39fe3b2..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - IOutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index cad179f..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - IOutterForInt.Inner? subject = default; - - // Act - Action act = () => _ = (int)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs deleted file mode 100644 index 6c1cbb7..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index 74fb2a8..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - IOutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index fb59a72..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..ed612d8 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + IOutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..c18b8b9 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualityOperatorWithIOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + IOutterForInt.Inner? left = default; + IOutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + IOutterForInt.Inner? left = default; + IOutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.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/IOutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..b18037c --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + IOutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForInt.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/IOutterForIntTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..faf4528 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualsWithIOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.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/IOutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..309bf36 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForInt.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/IOutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..038d2ce --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentIOutterForIntInnerThenReturnTrue() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + object other = new IOutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + IOutterForInt.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/IOutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..d51d927 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + IOutterForInt.Inner first = new(FirstValue); + IOutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + IOutterForInt.Inner first = new(FirstValue); + IOutterForInt.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/IOutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..198bc49 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + IOutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..3be47c1 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + IOutterForInt.Inner? subject = default; + + // Act + Action act = () => _ = (int)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..6d1aa6d --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests; + +public static class WhenInequalityOperatorWithIOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.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/IOutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..0c60b7c --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + IOutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + IOutterForInt.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/IOutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..7a545b2 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + IOutterForInt.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/IOutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index c8bf8f5..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - IOutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs deleted file mode 100644 index 4cd021b..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithIOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - IOutterForString.Inner? left = default; - IOutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - IOutterForString.Inner? left = default; - IOutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - IOutterForString.Inner left = new(leftValue); - IOutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.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/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index cd7557f..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - IOutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - IOutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForString.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/IOutterForStringTests/InnerTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs deleted file mode 100644 index 4ce3014..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualsWithIOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.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/IOutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 7ca96f5..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentIOutterForStringInnerThenReturnTrue() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - object other = new IOutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - IOutterForString.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/IOutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index d6e8e5c..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForString.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/IOutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 4082efb..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - IOutterForString.Inner first = new(FirstValue); - IOutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - IOutterForString.Inner first = new(FirstValue); - IOutterForString.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/IOutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index 3f35fcb..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - IOutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index f6cd281..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - IOutterForString.Inner? subject = default; - - // Act - Action act = () => _ = (string)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs deleted file mode 100644 index 01679c6..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithIOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - IOutterForString.Inner left = new(leftValue); - IOutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.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/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index b3c4168..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - IOutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - IOutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - IOutterForString.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/IOutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index abe9140..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - IOutterForString.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/IOutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..976b42a --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + IOutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..919acb3 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualityOperatorWithIOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + IOutterForString.Inner? left = default; + IOutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + IOutterForString.Inner? left = default; + IOutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + IOutterForString.Inner left = new(leftValue); + IOutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.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/IOutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..59a51f0 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + IOutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + IOutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForString.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/IOutterForStringTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..5d075a2 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualsWithIOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.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/IOutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..8b2466e --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentIOutterForStringInnerThenReturnTrue() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + object other = new IOutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + IOutterForString.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/IOutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..a33b297 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForString.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/IOutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..7c19bb9 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + IOutterForString.Inner first = new(FirstValue); + IOutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + IOutterForString.Inner first = new(FirstValue); + IOutterForString.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/IOutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..711bce0 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + IOutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..28f7f52 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + IOutterForString.Inner? subject = default; + + // Act + Action act = () => _ = (string)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..f29b0ef --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests; + +public static class WhenInequalityOperatorWithIOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + IOutterForString.Inner left = new(leftValue); + IOutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.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/IOutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..333477d --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + IOutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + IOutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + IOutterForString.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/IOutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..bf6d7c6 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InInterface/IOutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InInterface.IOutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + IOutterForString.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/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 28c0a10..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index e220c44..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index f30fde5..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index 7ae2270..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index c641cd5..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - object other = new OutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 780c95b..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index ff94a4a..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index 1cfaeda..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index 0f8e9a5..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - Action act = () => _ = (int[])subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 3d8db6f..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 04fb3d4..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index b5f9b87..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - OutterForArray.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/OutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..c493da8 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..e6cd0ce --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..4b702cc --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..8ad4f74 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..35aaeeb --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + object other = new OutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..c66b0eb --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualsWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..1a4534e --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.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/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..b51fe74 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..d12d6db --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + Action act = () => _ = (int[])subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..f58a433 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..5a7796d --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests; + +public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..6a7395f --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForArray.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/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 776e83b..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index 58ac849..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 0faa8d6..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index 70c74ff..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index d23a119..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForIntInnerThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - object other = new OutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 74ac333..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 9a20a2e..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index 09cee1f..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index faf21e6..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - Action act = () => _ = (int)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index 69506bc..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index d0e5a87..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index ddefa09..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - OutterForInt.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/OutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..acb2cca --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..9560cdf --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..fee0040 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..84a26f9 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..9371b2c --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForIntInnerThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + object other = new OutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..dfaf2b8 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualsWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..a6a73b6 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.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/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..9d89192 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..705d712 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + Action act = () => _ = (int)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..3ef1df4 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..7414374 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests; + +public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..bed3007 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForInt.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/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 2a5895b..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 809145d..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index aa05928..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index fc2d643..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForStringInnerThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - object other = new OutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 14f42f2..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index 4557b3c..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index fc1a754..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index 1a1ab61..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index 3a27da5..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - Action act = () => _ = (string)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 7cf1ad6..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index f5bb89f..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 7d55327..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - OutterForString.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/OutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..0887f1b --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..355881c --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..c0ce4d0 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..a90b93c --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForStringInnerThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + object other = new OutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..a8c4b77 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualsWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..575cadc --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..cfaa56f --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.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/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..5c80f96 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..d11e51a --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + Action act = () => _ = (string)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..fb9f1dd --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests; + +public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..e094102 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..c5ca5b7 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecord/OutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecord.OutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForString.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/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 6b17d37..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 0283ce8..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 08c04f5..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index a21ae1b..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 53b055c..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - object other = new OutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 8046333..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index d4fe9f4..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index e1bf6ec..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index 91ea60a..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - Action act = () => _ = (int[])subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 0c615e9..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index b091c2d..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index fccc5f8..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - OutterForArray.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/OutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..404da34 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..b999020 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..9dd1a0e --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..10acab5 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..77ab582 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + object other = new OutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..0684356 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualsWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..49cdc02 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.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/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..7b2b1c9 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..969c2e2 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + Action act = () => _ = (int[])subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..111c951 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..bdce581 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..fbfb6eb --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForArray.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/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 26a7271..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index 6ef252d..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index b7a012f..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index b6ba974..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index c3339bf..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForIntInnerThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - object other = new OutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 9ff153a..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 2de2f3b..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index 3e811a5..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index 74e6c1a..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - Action act = () => _ = (int)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index fcb75dc..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 5446785..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 8ce5241..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - OutterForInt.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/OutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..16d5257 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..723cfe5 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..aa6040d --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..20023a3 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..84ba7e6 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForIntInnerThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + object other = new OutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..1193a28 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualsWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..a1a626c --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.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/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..6ce3916 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..754c014 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + Action act = () => _ = (int)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..9147376 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..0246bf7 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..614da8e --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForInt.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/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 1d91e6c..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 05fcbd0..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index 74d8cff..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 7a286f2..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForStringInnerThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - object other = new OutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 0389dbc..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index 7dca359..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 2d5f6d6..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index dae94da..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index e62b634..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - Action act = () => _ = (string)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index f76a9aa..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index 9530fc5..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 63edc3d..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - OutterForString.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/OutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..c683829 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..7e001e8 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..1b5930c --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..cb2d7d6 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForStringInnerThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + object other = new OutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..a7dfbee --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualsWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..04c5ad9 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..c863f43 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.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/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..bb90141 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..c46a38b --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + Action act = () => _ = (string)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..13ac0cf --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..cd49f12 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..bcb2492 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InRecordStruct/OutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForString.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/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index bb23a1b..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index c8890f6..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 1a67001..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index 63f6052..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 2019cc0..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - object other = new OutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 5a5ab0a..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 76ba9c7..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index b32a647..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index 40d8bee..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - Action act = () => _ = (int[])subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index a06e654..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index dc6c076..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index a690380..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - OutterForArray.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/OutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..324ab01 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..70497b3 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..7e04409 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..be0c741 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..3a3fcdc --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + object other = new OutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..177b68f --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualsWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..b082456 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.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/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..5091c58 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..b82cb37 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + Action act = () => _ = (int[])subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..64f1e9d --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..52428bd --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests; + +public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..1ebdad4 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForArray.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/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index c8a238d..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index 19a99c0..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 4317fd2..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index 0da6d59..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index d5b181c..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForIntInnerThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - object other = new OutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 58e7eb0..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index da46448..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index 88dd7a8..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index 438bae8..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - Action act = () => _ = (int)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index bb31bb4..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 97a9574..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 6019726..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - OutterForInt.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/OutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..108f67a --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..4cc3da8 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..b948668 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..5d9e716 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..0ec92c6 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForIntInnerThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + object other = new OutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..fd278ac --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualsWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..619a2ed --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.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/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..87602e8 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..b748e7f --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + Action act = () => _ = (int)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..276a333 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..65cb417 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests; + +public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..85e8f85 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForInt.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/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index cc8eeed..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index e4df1c3..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index 0e1cdb8..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index daf8f67..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals((object?)default); - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentOutterForStringInnerThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - object other = new OutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 10cf7c6..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index 1756340..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 94c1523..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index 12e3e7d..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index fb802f9..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullSubjectThenThrowsArgumentNullException() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - Action act = () => _ = (string)subject!; - - // Assert - ArgumentNullException exception = Should.Throw(act); - exception.ParamName.ShouldBe(nameof(subject)); - } - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 4237bf8..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index cdf7676..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 4295448..0000000 --- a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnRecordDescription() - { - // Arrange - OutterForString.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/OutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..619eb3d --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..1d1e17a --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..3a93ad5 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..496c56b --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals((object?)default); + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentOutterForStringInnerThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + object other = new OutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..b96967f --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualsWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..5af86ce --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..0063eb1 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.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/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..5656830 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..6c90fdd --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullSubjectThenThrowsArgumentNullException() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + Action act = () => _ = (string)subject!; + + // Assert + ArgumentNullException exception = Should.Throw(act); + exception.ParamName.ShouldBe(nameof(subject)); + } + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..cfba7f0 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests; + +public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..18e1f40 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..8d27e86 --- /dev/null +++ b/src/Monify.Console.Tests/Records/Nested/InStruct/OutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Records.Nested.InStruct.OutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnRecordDescription() + { + // Arrange + OutterForString.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/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 4c087ec..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index de2cbab..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 12271d8..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index 812aef2..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 268c28d..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - object other = new OutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 9e7e353..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index d6e1ca6..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index 66a7536..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index 74fbd36..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index bd1b317..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 7e4a49a..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 0bfb647..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { System.Int32[] }"; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForArray.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/InClass/OutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..7036c74 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..e265a08 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..adca9fa --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..9088770 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..d5b2799 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + object other = new OutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..bd7caae --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests; + +public static class WhenEqualsWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..d81a1ab --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.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/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..8f9a42e --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..6ce9f36 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..af98cd8 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..e074418 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests; + +public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..142e7c3 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { System.Int32[] }"; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForArray.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/InClass/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 047d178..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index 964202e..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 3a513e4..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index 43d462c..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 9b53ce4..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentOutterForIntInnerThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - object other = new OutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index ab8a8cd..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 28a8a8a..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index aa27b6c..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index d6754a4..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index 86a4418..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 8e5d066..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index b5b94da..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { 42 }"; - private const int SampleValue = 42; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForInt.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/InClass/OutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..4bc9368 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..edadf9e --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..649262d --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests; + +public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..3682994 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..652bf4c --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForIntInnerThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + object other = new OutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..6f7162a --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests; + +public static class WhenEqualsWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..6a2d8ac --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.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/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..c5a64a1 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..0ce30f2 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..0508265 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..ad0ee27 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests; + +public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..0ef6b20 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { 42 }"; + private const int SampleValue = 42; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForInt.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/InClass/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index c3aedbf..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index b4febe2..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index 7750f68..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 8dd6ac0..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentOutterForStringInnerThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - object other = new OutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 2c60288..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index b1a44c6..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 3829ec0..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index 06d1bac..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index 55adaa0..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 8791f45..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index 8ceb7d6..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 30b5bb8..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = $"Inner {{ {SampleValue} }}"; - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForString.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/InClass/OutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..101075f --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..7ec3502 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests; + +public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..6507a06 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..660610b --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForStringInnerThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + object other = new OutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..b3a48dd --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests; + +public static class WhenEqualsWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..09c4da1 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..c7fc878 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.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/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..6c0d559 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..db65970 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..1639f13 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests; + +public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..090cdae --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..fb572ad --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InClass/OutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InClass.OutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = $"Inner {{ {SampleValue} }}"; + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForString.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/IOutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 957163d..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - IOutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 1878ecb..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - IOutterForArray.Inner? left = default; - IOutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - IOutterForArray.Inner? left = default; - IOutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - IOutterForArray.Inner left = new(leftValues); - IOutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index fdd9f1c..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - IOutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 852a4b5..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index 937b0b4..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 149e0ac..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentIOutterForArrayInnerThenReturnTrue() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - object other = new IOutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 2c13a63..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - IOutterForArray.Inner first = new(_firstValue); - IOutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - IOutterForArray.Inner first = new(_firstValue); - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index 179a01d..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - IOutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index 2d89b36..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 63e2a4d..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - IOutterForArray.Inner left = new(leftValues); - IOutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - IOutterForArray.Inner left = new(_sampleValue); - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 8916528..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - IOutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 512e591..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { System.Int32[] }"; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - IOutterForArray.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/IOutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..9cc4f43 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + IOutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..71fedb7 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualityOperatorWithIOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + IOutterForArray.Inner? left = default; + IOutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + IOutterForArray.Inner? left = default; + IOutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + IOutterForArray.Inner left = new(leftValues); + IOutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.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/IOutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..fc99706 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + IOutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForArray.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/IOutterForArrayTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..1930e53 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithIOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualsWithIOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.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/IOutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..79419bd --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForArray.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/IOutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..d22b2c2 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentIOutterForArrayInnerThenReturnTrue() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + object other = new IOutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + IOutterForArray.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/IOutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..1d13a10 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + IOutterForArray.Inner first = new(_firstValue); + IOutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + IOutterForArray.Inner first = new(_firstValue); + IOutterForArray.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/IOutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..7c2d36b --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + IOutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..aadebee --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..3127692 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests; + +public static class WhenInequalityOperatorWithIOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + IOutterForArray.Inner left = new(leftValues); + IOutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + IOutterForArray.Inner left = new(_sampleValue); + IOutterForArray.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/IOutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..ebee1fc --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + IOutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + IOutterForArray.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/IOutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..1a30b78 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { System.Int32[] }"; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + IOutterForArray.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/IOutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 9d43595..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - IOutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs deleted file mode 100644 index fc7da0e..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - IOutterForInt.Inner? left = default; - IOutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - IOutterForInt.Inner? left = default; - IOutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index 5dcda31..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - IOutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs deleted file mode 100644 index f2e8d95..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualsWithIOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index ec5d9b3..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 9a853a0..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentIOutterForIntInnerThenReturnTrue() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - object other = new IOutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 76a68e3..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - IOutterForInt.Inner first = new(FirstValue); - IOutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - IOutterForInt.Inner first = new(FirstValue); - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index b1b8504..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - IOutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index 2424dc1..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs deleted file mode 100644 index 47bc50d..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - IOutterForInt.Inner left = new(SampleValue); - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index 19d63a8..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - IOutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 401aa58..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { 42 }"; - private const int SampleValue = 42; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - IOutterForInt.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/IOutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..a063e56 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + IOutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..92e54e2 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualityOperatorWithIOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + IOutterForInt.Inner? left = default; + IOutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + IOutterForInt.Inner? left = default; + IOutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.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/IOutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..4e760d4 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + IOutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForInt.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/IOutterForIntTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..503cb2b --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenEqualsWithIOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualsWithIOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.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/IOutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..a4b2a59 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForInt.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/IOutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..ac3064b --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentIOutterForIntInnerThenReturnTrue() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + object other = new IOutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + IOutterForInt.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/IOutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..2bc6196 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + IOutterForInt.Inner first = new(FirstValue); + IOutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + IOutterForInt.Inner first = new(FirstValue); + IOutterForInt.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/IOutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..6df9779 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + IOutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..ec6fccc --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..b400708 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests; + +public static class WhenInequalityOperatorWithIOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + IOutterForInt.Inner left = new(SampleValue); + IOutterForInt.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/IOutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..f8ee492 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + IOutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + IOutterForInt.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/IOutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..73ec601 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { 42 }"; + private const int SampleValue = 42; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + IOutterForInt.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/IOutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 82a8d24..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - IOutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs deleted file mode 100644 index aaa9790..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithIOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - IOutterForString.Inner? left = default; - IOutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - IOutterForString.Inner? left = default; - IOutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - IOutterForString.Inner left = new(leftValue); - IOutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.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/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index d78e596..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - IOutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - IOutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForString.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/IOutterForStringTests/InnerTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs deleted file mode 100644 index 6afc267..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualsWithIOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.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/IOutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 83a75ec..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentIOutterForStringInnerThenReturnTrue() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - object other = new IOutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - IOutterForString.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/IOutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index 7f40f80..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - IOutterForString.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/IOutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 2c829c2..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - IOutterForString.Inner first = new(FirstValue); - IOutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - IOutterForString.Inner first = new(FirstValue); - IOutterForString.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/IOutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index 72bcfa2..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - IOutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index 9417ac8..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs deleted file mode 100644 index 5ee1063..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithIOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - IOutterForString.Inner left = new(leftValue); - IOutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - IOutterForString.Inner left = new(SampleValue); - IOutterForString.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/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index ec640b9..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - IOutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - IOutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - IOutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - IOutterForString.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/IOutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 8dc363b..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = $"Inner {{ {SampleValue} }}"; - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - IOutterForString.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/IOutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..71e2dbd --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + IOutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..4c145b0 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithIOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualityOperatorWithIOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + IOutterForString.Inner? left = default; + IOutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + IOutterForString.Inner? left = default; + IOutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + IOutterForString.Inner left = new(leftValue); + IOutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.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/IOutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..001a79d --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + IOutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + IOutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForString.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/IOutterForStringTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..5c0893e --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenEqualsWithIOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualsWithIOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.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/IOutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..4fa2c06 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentIOutterForStringInnerThenReturnTrue() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + object other = new IOutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + IOutterForString.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/IOutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..cd7dc93 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + IOutterForString.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/IOutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..7cc86f7 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + IOutterForString.Inner first = new(FirstValue); + IOutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + IOutterForString.Inner first = new(FirstValue); + IOutterForString.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/IOutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..e1326c2 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + IOutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..877b02b --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..447aea9 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithIOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests; + +public static class WhenInequalityOperatorWithIOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + IOutterForString.Inner left = new(leftValue); + IOutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + IOutterForString.Inner left = new(SampleValue); + IOutterForString.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/IOutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..52c4b1b --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + IOutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + IOutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + IOutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + IOutterForString.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/IOutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..5392a1c --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InInterface/IOutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InInterface.IOutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = $"Inner {{ {SampleValue} }}"; + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + IOutterForString.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/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 685b3f1..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 46b4376..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 53b1493..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index 676bd85..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index d38ef74..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - object other = new OutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index d9eb62c..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 31b6741..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index 87dd862..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index 1436569..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 9395098..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 9f0b48a..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 320bc66..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { System.Int32[] }"; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForArray.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/OutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..25b770a --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..5b311d0 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..98850b5 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..6b88ba1 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..be6dbc2 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + object other = new OutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..f48163b --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests; + +public static class WhenEqualsWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..06c3b6d --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.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/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..6a41e99 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..f7c1d85 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..923ff4a --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..90c1061 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests; + +public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..01eb80c --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { System.Int32[] }"; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForArray.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/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 72aff7e..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index d44224d..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 970ce3d..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index bd56fa4..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 2a1f6f8..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentOutterForIntInnerThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - object other = new OutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 8c1d0b7..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 6d445f0..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index 794940d..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index 7e71347..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index d48ae85..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index d09575a..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 5af58cb..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { 42 }"; - private const int SampleValue = 42; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForInt.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/OutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..d1da605 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..f655c01 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..becc2aa --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..f17fad5 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..d964d89 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForIntInnerThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + object other = new OutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..a6a6c8a --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests; + +public static class WhenEqualsWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..fc6d434 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.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/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..f24c74b --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..ca00686 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..56ce674 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..14e18cc --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests; + +public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..ce6a056 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { 42 }"; + private const int SampleValue = 42; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForInt.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/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index fa8d3e0..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 7043cbd..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index f93a510..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 1207dfe..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentOutterForStringInnerThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - object other = new OutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index fc94faf..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index 595c618..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 9712e65..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index a4d8e62..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index eaaf8f5..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index cb740b2..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index 7b00429..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index e627b6d..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = $"Inner {{ {SampleValue} }}"; - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForString.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/OutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..c929bfa --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..4aeb1bc --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..82cc107 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..d14cbff --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForStringInnerThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + object other = new OutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..d06b898 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualsWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..bead3ee --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..565f75a --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.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/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..6f1bbd5 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..c89aa23 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..65235c7 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests; + +public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..a54ce1d --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..34ca90a --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecord/OutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InRecord.OutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = $"Inner {{ {SampleValue} }}"; + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForString.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/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index d4b1c87..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 3c711ee..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 0421871..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index 8cfe647..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 839ce9d..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - object other = new OutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 3721ef8..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index c29292f..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index e3ae9ef..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index b4265d0..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 9b5506f..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 382524e..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 93f5164..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { System.Int32[] }"; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForArray.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/OutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..e42827d --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..730589c --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..6699bd9 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..278b551 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..2e89927 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + object other = new OutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..426a622 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenEqualsWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..09ebc0f --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.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/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..ba69e98 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..db0362d --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..98b8733 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..2424036 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..695ea11 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { System.Int32[] }"; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForArray.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/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index e6ccc7d..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index b5df8e9..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index e1b25e2..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index 38f8117..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index ab798ec..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentOutterForIntInnerThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - object other = new OutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 9ae6a48..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index dc7544b..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index e941552..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index 1906b93..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index 2ca6d86..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index ae7f9ab..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 9d3ea15..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { 42 }"; - private const int SampleValue = 42; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForInt.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/OutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..da7eb32 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..a2c5015 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..b3115b0 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..0dfbe13 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..e61a913 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForIntInnerThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + object other = new OutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..d55c5e7 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenEqualsWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..685a967 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.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/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..0d05af0 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..7c6d8a1 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..ad93d51 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..dfafdfc --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..5335a21 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { 42 }"; + private const int SampleValue = 42; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForInt.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/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index dac03f4..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 32fed4b..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index b682f35..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index dfd4da9..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentOutterForStringInnerThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - object other = new OutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 4e84d77..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index e0d3e08..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 23766e9..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index f3aaa50..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index 37b3613..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 26026dc..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index 4b1961e..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 26cf28b..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = $"Inner {{ {SampleValue} }}"; - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForString.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/OutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..d0bbc39 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..af59c5b --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..c7e5f54 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..65de7fc --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForStringInnerThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + object other = new OutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..b5fa84f --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualsWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..b10656c --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..edff7b7 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.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/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..0392a56 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..a234e80 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..eb43ae1 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..ff883e9 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..9aa23b3 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InRecordStruct/OutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InRecordStruct.OutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = $"Inner {{ {SampleValue} }}"; + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForString.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/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 28ff4a5..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForArray.Inner instance = new(_sampleValue); - - // Act - int[] actual = instance; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 005ffb9..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject == _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 2fcfc3d..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForArray.Inner? left = default; - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs deleted file mode 100644 index 23fa17d..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithIntArrayIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject.Equals(_sampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 7168f05..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - object other = new OutterForArray.Inner(_sampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 0ac51c6..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenEqualsWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index b95ea35..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private static readonly int[] _firstValue = [7, 8, 9]; - private static readonly int[] _secondValue = [10, 11, 12]; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.Inner second = new(_firstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForArray.Inner first = new(_firstValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs deleted file mode 100644 index 2bbb495..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorFromIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorFromIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForArray.Inner result = _sampleValue; - - // Act - int[] actual = result; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs deleted file mode 100644 index 8a62d6c..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenImplicitOperatorToIntArrayIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenImplicitOperatorToIntArrayIsCalled -{ - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - int[] actual = subject; - - // Assert - actual.ShouldBe(_sampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs deleted file mode 100644 index 3ff898c..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithIntArrayIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithIntArrayIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForArray.Inner? subject = default; - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner subject = new(_sampleValue); - - // Act - bool actual = subject != _sampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForArray.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/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs deleted file mode 100644 index 5ef82cb..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled -{ - private static readonly int[] _differentValue = [4, 5, 6]; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.Inner right = new(_sampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - int[] leftValues = [1, 2, 3]; - int[] rightValues = [1, 2, 3]; - OutterForArray.Inner left = new(leftValues); - OutterForArray.Inner right = new(rightValues); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForArray.Inner left = new(_sampleValue); - OutterForArray.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/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 8ecb142..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { System.Int32[] }"; - private static readonly int[] _sampleValue = [1, 2, 3]; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForArray.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/OutterForArrayTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..871477c --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests; + +public static class WhenConstructorIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForArray.Inner instance = new(_sampleValue); + + // Act + int[] actual = instance; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..86b3186 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject == _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..b9caf24 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenEqualityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForArray.Inner? left = default; + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs new file mode 100644 index 0000000..8eca845 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenEqualsWithIntArrayIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualsWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject.Equals(_sampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..4408fd8 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForArrayInnerThenReturnTrue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + object other = new OutterForArray.Inner(_sampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..c1d2824 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenEqualsWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests; + +public static class WhenEqualsWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..5f30fc1 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests; + +public static class WhenGetHashCodeIsCalled +{ + private static readonly int[] _firstValue = [7, 8, 9]; + private static readonly int[] _secondValue = [10, 11, 12]; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.Inner second = new(_firstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForArray.Inner first = new(_firstValue); + OutterForArray.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/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs new file mode 100644 index 0000000..be19f3a --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorFromIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests; + +public static class WhenImplicitOperatorFromIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForArray.Inner result = _sampleValue; + + // Act + int[] actual = result; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs new file mode 100644 index 0000000..f398173 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenImplicitOperatorToIntArrayIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests; + +public static class WhenImplicitOperatorToIntArrayIsCalled +{ + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + int[] actual = subject; + + // Assert + actual.ShouldBe(_sampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs new file mode 100644 index 0000000..0ea40fe --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithIntArrayIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests; + +public static class WhenInequalityOperatorWithIntArrayIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForArray.Inner? subject = default; + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner subject = new(_sampleValue); + + // Act + bool actual = subject != _sampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForArray.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/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs new file mode 100644 index 0000000..0374089 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenInequalityOperatorWithOutterForArrayInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests; + +public static class WhenInequalityOperatorWithOutterForArrayInnerIsCalled +{ + private static readonly int[] _differentValue = [4, 5, 6]; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.Inner right = new(_sampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + int[] leftValues = [1, 2, 3]; + int[] rightValues = [1, 2, 3]; + OutterForArray.Inner left = new(leftValues); + OutterForArray.Inner right = new(rightValues); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForArray.Inner left = new(_sampleValue); + OutterForArray.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/OutterForArrayTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..d365672 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForArrayTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForArrayTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { System.Int32[] }"; + private static readonly int[] _sampleValue = [1, 2, 3]; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForArray.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/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index d480490..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForInt.Inner instance = new(SampleValue); - - // Act - int actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs deleted file mode 100644 index d5d26e9..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 535a0f2..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForInt.Inner? left = default; - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs deleted file mode 100644 index e1ae1ee..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithIntIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index 71d4148..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentOutterForIntInnerThenReturnTrue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - object other = new OutterForInt.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 69ea5f1..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenEqualsWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenEqualsWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 6f858a3..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const int FirstValue = 5; - private const int SecondValue = 9; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForInt.Inner first = new(FirstValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs deleted file mode 100644 index c4860df..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorFromIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorFromIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForInt.Inner result = SampleValue; - - // Act - int actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs deleted file mode 100644 index 338894e..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenImplicitOperatorToIntIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenImplicitOperatorToIntIsCalled -{ - private const int SampleValue = 42; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - int actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs deleted file mode 100644 index c04c18f..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithIntIsCalled.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithIntIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForInt.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForInt.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/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs deleted file mode 100644 index 1b1b1f4..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled -{ - private const int DifferentValue = 84; - private const int SampleValue = 42; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForInt.Inner left = new(SampleValue); - OutterForInt.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/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index e742f9c..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = "Inner { 42 }"; - private const int SampleValue = 42; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForInt.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/OutterForIntTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..2dedd44 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests; + +public static class WhenConstructorIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForInt.Inner instance = new(SampleValue); + + // Act + int actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..5b0a6fb --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..d212560 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenEqualityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,63 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForInt.Inner? left = default; + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenEqualsWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenEqualsWithIntIsCalled.cs new file mode 100644 index 0000000..7200d90 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenEqualsWithIntIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualsWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..7a42732 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForIntInnerThenReturnTrue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + object other = new OutterForInt.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..09d2426 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenEqualsWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests; + +public static class WhenEqualsWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..97078cc --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests; + +public static class WhenGetHashCodeIsCalled +{ + private const int FirstValue = 5; + private const int SecondValue = 9; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForInt.Inner first = new(FirstValue); + OutterForInt.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/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs new file mode 100644 index 0000000..5f38214 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorFromIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests; + +public static class WhenImplicitOperatorFromIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForInt.Inner result = SampleValue; + + // Act + int actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs new file mode 100644 index 0000000..8768e8f --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenImplicitOperatorToIntIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests; + +public static class WhenImplicitOperatorToIntIsCalled +{ + private const int SampleValue = 42; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + int actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs new file mode 100644 index 0000000..c420828 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithIntIsCalled.cs @@ -0,0 +1,46 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests; + +public static class WhenInequalityOperatorWithIntIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForInt.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForInt.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/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs new file mode 100644 index 0000000..b1f9d25 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenInequalityOperatorWithOutterForIntInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests; + +public static class WhenInequalityOperatorWithOutterForIntInnerIsCalled +{ + private const int DifferentValue = 84; + private const int SampleValue = 42; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForInt.Inner left = new(SampleValue); + OutterForInt.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/OutterForIntTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..695880c --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForIntTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForIntTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = "Inner { 42 }"; + private const int SampleValue = 42; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForInt.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/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs deleted file mode 100644 index 6b1b911..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenConstructorIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenConstructorIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenValueIsStored() - { - // Arrange - OutterForString.Inner instance = new(SampleValue); - - // Act - string actual = instance; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 782fe51..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenBothNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner? right = default; - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenLeftIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? left = default; - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnTrue() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left == right; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs deleted file mode 100644 index 411cff0..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnFalse() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject == SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnTrue() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject == comparisonValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs deleted file mode 100644 index ec2c7b1..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithObjectIsCalled.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithObjectIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenNullThenThrowNullReferenceException() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - Action act = () => subject.Equals((object?)default); - - // Assert - _ = Should.Throw(act); - } - - [Fact] - public static void GivenEquivalentOutterForStringInnerThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - object other = new OutterForString.Inner(SampleValue); - - // Act - bool actual = subject.Equals(other); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentTypeThenThrowInvalidCastException() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index c400784..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left.Equals(right); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs deleted file mode 100644 index 8bd63c6..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenEqualsWithStringIsCalled.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenEqualsWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnTrue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject.Equals(SampleValue); - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenDifferentValueThenReturnFalse() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs deleted file mode 100644 index 27a9815..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenGetHashCodeIsCalled.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenGetHashCodeIsCalled -{ - private const string FirstValue = "Alpha"; - private const string SecondValue = "Beta"; - - [Fact] - public static void GivenSameValuesThenReturnSameHashCode() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.Inner second = new(FirstValue); - - // Act - int firstHash = first.GetHashCode(); - int secondHash = second.GetHashCode(); - - // Assert - firstHash.ShouldBe(secondHash); - } - - [Fact] - public static void GivenDifferentValuesThenReturnDifferentHashCodes() - { - // Arrange - OutterForString.Inner first = new(FirstValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs deleted file mode 100644 index 435819b..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorFromStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorFromStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueThenReturnsEquivalentInstance() - { - // Arrange - OutterForString.Inner result = SampleValue; - - // Act - string actual = result; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs deleted file mode 100644 index 242d81e..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenImplicitOperatorToStringIsCalled.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenImplicitOperatorToStringIsCalled -{ - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValidSubjectThenReturnsValue() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - string actual = subject; - - // Assert - actual.ShouldBe(SampleValue); - } -} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs deleted file mode 100644 index 2653aec..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.Inner right = new(SampleValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValuesThenReturnFalse() - { - // Arrange - string leftValue = new(SampleValue.ToCharArray()); - string rightValue = new(SampleValue.ToCharArray()); - OutterForString.Inner left = new(leftValue); - OutterForString.Inner right = new(rightValue); - - // Act - bool actual = left != right; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValuesThenReturnTrue() - { - // Arrange - OutterForString.Inner left = new(SampleValue); - OutterForString.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/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs deleted file mode 100644 index 20ac1cc..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenInequalityOperatorWithStringIsCalled.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenInequalityOperatorWithStringIsCalled -{ - private const string SampleValue = "Sample"; - private const string DifferentValue = "Different"; - - [Fact] - public static void GivenSubjectIsNullThenReturnTrue() - { - // Arrange - OutterForString.Inner? subject = default; - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeTrue(); - } - - [Fact] - public static void GivenSameValueThenReturnFalse() - { - // Arrange - OutterForString.Inner subject = new(SampleValue); - - // Act - bool actual = subject != SampleValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenEquivalentValueThenReturnFalse() - { - // Arrange - string subjectValue = new(SampleValue.ToCharArray()); - string comparisonValue = new(SampleValue.ToCharArray()); - OutterForString.Inner subject = new(subjectValue); - - // Act - bool actual = subject != comparisonValue; - - // Assert - actual.ShouldBeFalse(); - } - - [Fact] - public static void GivenDifferentValueThenReturnTrue() - { - // Arrange - OutterForString.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/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs deleted file mode 100644 index 3ec40bc..0000000 --- a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/InnerTests/WhenToStringIsCalled.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests.InnerTests; - -public static class WhenToStringIsCalled -{ - private const string Expected = $"Inner {{ {SampleValue} }}"; - private const string SampleValue = "Sample"; - - [Fact] - public static void GivenValueTheExpectedStringIsReturned() - { - // Arrange - OutterForString.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/OutterForStringTests/WhenConstructorIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenConstructorIsCalled.cs new file mode 100644 index 0000000..546ba59 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenConstructorIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests; + +public static class WhenConstructorIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenValueIsStored() + { + // Arrange + OutterForString.Inner instance = new(SampleValue); + + // Act + string actual = instance; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..dd41828 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,79 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenBothNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner? right = default; + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenLeftIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? left = default; + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnTrue() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left == right; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..ce1994f --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenEqualityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnFalse() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject == SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnTrue() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject == comparisonValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs new file mode 100644 index 0000000..99693b9 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenEqualsWithObjectIsCalled.cs @@ -0,0 +1,47 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualsWithObjectIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenNullThenThrowNullReferenceException() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + Action act = () => subject.Equals((object?)default); + + // Assert + _ = Should.Throw(act); + } + + [Fact] + public static void GivenEquivalentOutterForStringInnerThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + object other = new OutterForString.Inner(SampleValue); + + // Act + bool actual = subject.Equals(other); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentTypeThenThrowInvalidCastException() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..ad4fec2 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenEqualsWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,35 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualsWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left.Equals(right); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenEqualsWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenEqualsWithStringIsCalled.cs new file mode 100644 index 0000000..21fad2f --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenEqualsWithStringIsCalled.cs @@ -0,0 +1,33 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests; + +public static class WhenEqualsWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnTrue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject.Equals(SampleValue); + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenDifferentValueThenReturnFalse() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenGetHashCodeIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenGetHashCodeIsCalled.cs new file mode 100644 index 0000000..7cc54a5 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenGetHashCodeIsCalled.cs @@ -0,0 +1,37 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests; + +public static class WhenGetHashCodeIsCalled +{ + private const string FirstValue = "Alpha"; + private const string SecondValue = "Beta"; + + [Fact] + public static void GivenSameValuesThenReturnSameHashCode() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.Inner second = new(FirstValue); + + // Act + int firstHash = first.GetHashCode(); + int secondHash = second.GetHashCode(); + + // Assert + firstHash.ShouldBe(secondHash); + } + + [Fact] + public static void GivenDifferentValuesThenReturnDifferentHashCodes() + { + // Arrange + OutterForString.Inner first = new(FirstValue); + OutterForString.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/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs new file mode 100644 index 0000000..74ca011 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorFromStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests; + +public static class WhenImplicitOperatorFromStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueThenReturnsEquivalentInstance() + { + // Arrange + OutterForString.Inner result = SampleValue; + + // Act + string actual = result; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs new file mode 100644 index 0000000..242d1b2 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenImplicitOperatorToStringIsCalled.cs @@ -0,0 +1,19 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests; + +public static class WhenImplicitOperatorToStringIsCalled +{ + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValidSubjectThenReturnsValue() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + string actual = subject; + + // Assert + actual.ShouldBe(SampleValue); + } +} \ No newline at end of file diff --git a/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs new file mode 100644 index 0000000..60248d7 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithOutterForStringInnerIsCalled.cs @@ -0,0 +1,51 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests; + +public static class WhenInequalityOperatorWithOutterForStringInnerIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.Inner right = new(SampleValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValuesThenReturnFalse() + { + // Arrange + string leftValue = new(SampleValue.ToCharArray()); + string rightValue = new(SampleValue.ToCharArray()); + OutterForString.Inner left = new(leftValue); + OutterForString.Inner right = new(rightValue); + + // Act + bool actual = left != right; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValuesThenReturnTrue() + { + // Arrange + OutterForString.Inner left = new(SampleValue); + OutterForString.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/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs new file mode 100644 index 0000000..7602b93 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenInequalityOperatorWithStringIsCalled.cs @@ -0,0 +1,61 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests; + +public static class WhenInequalityOperatorWithStringIsCalled +{ + private const string SampleValue = "Sample"; + private const string DifferentValue = "Different"; + + [Fact] + public static void GivenSubjectIsNullThenReturnTrue() + { + // Arrange + OutterForString.Inner? subject = default; + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeTrue(); + } + + [Fact] + public static void GivenSameValueThenReturnFalse() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + bool actual = subject != SampleValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenEquivalentValueThenReturnFalse() + { + // Arrange + string subjectValue = new(SampleValue.ToCharArray()); + string comparisonValue = new(SampleValue.ToCharArray()); + OutterForString.Inner subject = new(subjectValue); + + // Act + bool actual = subject != comparisonValue; + + // Assert + actual.ShouldBeFalse(); + } + + [Fact] + public static void GivenDifferentValueThenReturnTrue() + { + // Arrange + OutterForString.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/OutterForStringTests/WhenToStringIsCalled.cs b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenToStringIsCalled.cs new file mode 100644 index 0000000..2f37489 --- /dev/null +++ b/src/Monify.Console.Tests/Structs/Nested/InStruct/OutterForStringTests/WhenToStringIsCalled.cs @@ -0,0 +1,20 @@ +namespace Monify.Console.Structs.Nested.InStruct.OutterForStringTests; + +public static class WhenToStringIsCalled +{ + private const string Expected = $"Inner {{ {SampleValue} }}"; + private const string SampleValue = "Sample"; + + [Fact] + public static void GivenValueTheExpectedStringIsReturned() + { + // Arrange + OutterForString.Inner subject = new(SampleValue); + + // Act + string result = subject.ToString(); + + // Assert + result.ShouldBe(Expected); + } +} \ No newline at end of file