-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWhenWithNameIsCalled.cs
42 lines (36 loc) · 1.17 KB
/
WhenWithNameIsCalled.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
namespace Fluentify.Console.Class.NestedInInterfaceTests;
public sealed class WhenWithNameIsCalled
{
[Fact]
public void GivenNullSubjectThenArgumentNullExceptionIsThrown()
{
// Arrange
NestedInInterface.Simple? subject = default;
// Act
Func<NestedInInterface.Simple> act = () => subject!.WithName("Avery Brooks");
// Assert
_ = act.Should().Throw<ArgumentNullException>()
.WithParameterName(nameof(subject));
}
[Theory]
[InlineData("Avery Brooks")]
[InlineData("")]
[InlineData(" ")]
public void GivenANameThenTheValueIsApplied(string name)
{
// Arrange
var original = new NestedInInterface.Simple
{
Age = Random.Shared.Next(),
Attributes = [new(), new()],
Name = "Patrick Stewart",
};
// Act
NestedInInterface.Simple actual = original.WithName(name);
// Assert
_ = actual.Should().NotBeSameAs(original);
_ = actual.Age.Should().Be(original.Age);
_ = actual.Attributes.Should().BeEquivalentTo(original.Attributes);
_ = actual.Name.Should().BeEquivalentTo(name);
}
}