Skip to content

Commit 1ea8f01

Browse files
committed
test: id deserialization from file system
1 parent 897b344 commit 1ea8f01

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

Desktop.Tests/Integration/FileSystemTaskRepositoryTest.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,21 @@ public async SystemTask NoTaskArePersisted_ReturnsNothing()
2828
[Test]
2929
public async SystemTask CanLoadPersistedTasks()
3030
{
31+
var taskId = Guid.NewGuid();
3132
const string taskName = "aTaskName";
3233
const string taskDescription = "aTaskDescription";
33-
PersistTask(taskName, taskDescription);
34+
PersistTask(taskId, taskName, taskDescription);
3435
var sut = new FileSystemTaskRepository();
3536

3637
var result = await sut.All();
3738

3839
result.Tasks.Should().BeEquivalentTo(
3940
[
4041
new Task(
42+
id: taskId,
4143
name: taskName,
4244
description: taskDescription)
43-
],
44-
options => options.ComparingByMembers<Task>().Excluding(x => x.Id));
45+
]);
4546
result.Succeeded.Should().BeTrue();
4647
}
4748

@@ -222,8 +223,13 @@ public async SystemTask DeletesJustTheRequestedTask_KeepingTheOtherOnes()
222223

223224
private static void PersistTask(string name, string description = null)
224225
{
225-
var id = Guid.NewGuid();
226+
var anyId = Guid.NewGuid();
226227

228+
PersistTask(anyId, name, description);
229+
}
230+
231+
private static void PersistTask(Guid id, string name, string description = null)
232+
{
227233
File.AppendAllText(
228234
PersistedTasksFileName,
229235
$"{id}{LineElementSeparator}{name}{LineElementSeparator}{description ?? string.Empty}" +

0 commit comments

Comments
 (0)