-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -176,5 +176,38 @@ public async Task Aggregate_WhenCreatedChangedAndSavedWithPerformedBy_ShouldRetr | |
Assert.Equal(newEmail, repoUser?.Email); | ||
Assert.Equal(1, repoUser?.Version); | ||
} | ||
|
||
[Fact] | ||
public async Task Aggregate_WhenCreatedChangedThenChangedToInvalidAndSavedWithPerformedBy_ShouldRetrieve() | ||
{ | ||
var userId = User.NewUser(); | ||
|
||
const string? email = "[email protected]"; | ||
const string? auth = "auth_id"; | ||
|
||
var user = new UserAggregate(userId, email, auth); | ||
|
||
const string newEmail = "[email protected]"; | ||
const string invalidEmail = "faker_email"; | ||
|
||
user.ChangeEmail(newEmail); | ||
user.ChangeEmailToInvalid(invalidEmail); | ||
|
||
var sut = _fixture.GetSutObject(); | ||
|
||
var repoUser = await sut.GetById<UserAggregate>(userId); | ||
|
||
Assert.Null(repoUser); | ||
|
||
await sut.Save(user, userId); | ||
|
||
repoUser = await sut.GetById<UserAggregate>(userId); | ||
|
||
Assert.NotNull(repoUser); | ||
|
||
Assert.Equal(userId, repoUser?.Id); | ||
Assert.Equal(invalidEmail, repoUser?.Email); | ||
Assert.Equal(2, repoUser?.Version); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,5 +180,38 @@ public async Task Aggregate_WhenCreatedChangedAndSavedWithPerformedBy_ShouldRetr | |
Assert.Equal(newEmail, repoUser?.Email); | ||
Assert.Equal(1, repoUser?.Version); | ||
} | ||
|
||
[Fact] | ||
public async Task Aggregate_WhenCreatedChangedThenChangedToInvalidAndSavedWithPerformedBy_ShouldRetrieve() | ||
{ | ||
var userId = User.NewUser(); | ||
|
||
const string? email = "[email protected]"; | ||
const string? auth = "auth_id"; | ||
|
||
var user = new UserAggregate(userId, email, auth); | ||
|
||
const string newEmail = "[email protected]"; | ||
const string invalidEmail = "faker_email"; | ||
|
||
user.ChangeEmail(newEmail); | ||
user.ChangeEmailToInvalid(invalidEmail); | ||
|
||
var sut = _fixture.GetSutObject(); | ||
|
||
var repoUser = await sut.GetById<UserAggregate>(userId); | ||
|
||
Assert.Null(repoUser); | ||
|
||
await sut.Save(user, userId); | ||
|
||
repoUser = await sut.GetById<UserAggregate>(userId); | ||
|
||
Assert.NotNull(repoUser); | ||
|
||
Assert.Equal(userId, repoUser?.Id); | ||
Assert.Equal(invalidEmail, repoUser?.Email); | ||
Assert.Equal(2, repoUser?.Version); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters