Skip to content

Commit

Permalink
feat: add tests for multiple objects
Browse files Browse the repository at this point in the history
  • Loading branch information
meaboutsoftware committed Jun 18, 2024
1 parent 8a5dea2 commit eec4e8c
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,47 @@ internal void Given_two_different_type_objects_When_values_are_the_same_Then_sho
(firstObject != secondObject).Should().BeTrue();
}

[Fact]
internal void Given_multiple_objects_When_looking_for_specific_one_Then_should_return_only_the_matching_ones()
{
// Arrange
var valueObjects = new List<FakeValueObject>
{
new(),
new(),
new(2)
};

var targetValueObject = new FakeValueObject();

// Act
var result = valueObjects.Where(vo => vo == targetValueObject).ToList();

// Assert
result.Should().HaveCount(2);
result.Should().AllBeEquivalentTo(targetValueObject);
}

[Fact]
internal void Given_multiple_objects_When_looking_for_non_existing_one_Then_should_return_empty_result()
{
// Arrange
var valueObjects = new List<FakeValueObject>
{
new(),
new(),
new(2)
};

var targetValueObject = new FakeValueObject(3);

// Act
var result = valueObjects.Where(vo => vo == targetValueObject).ToList();

// Assert
result.Should().BeEmpty();
}

private class FakeValueObject(int property1 = DefaultIntProperty, string property2 = DefaultStringProperty) : ValueObject
{
private int Property1 { get; } = property1;
Expand Down

0 comments on commit eec4e8c

Please sign in to comment.