Skip to content

Commit 177f0ad

Browse files
committed
Added missing test for SingleOrDefault
1 parent b80273b commit 177f0ad

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

LinkDotNet.Blog.IntegrationTests/Infrastructure/Persistence/Sql/ProfileRepositoryTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,16 @@ public async Task ShouldDelete()
3737
items.Should().HaveCount(1);
3838
items[0].Id.Should().Be(item2.Id);
3939
}
40+
41+
[Fact]
42+
public async Task NoopOnDeleteWhenEntryNotFound()
43+
{
44+
var item = new ProfileInformationEntryBuilder().WithKey("key1").WithValue("value1").Build();
45+
await ProfileRepository.AddAsync(item);
46+
47+
await ProfileRepository.DeleteAsync("SomeIdWhichHopefullyDoesNotExist");
48+
49+
(await ProfileRepository.GetAllAsync()).Should().HaveCount(1);
50+
}
4051
}
4152
}

LinkDotNet.Blog.UnitTests/Infrastructure/Persistence/InMemory/ProfileRepositoryTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,16 @@ public async Task ShouldDelete()
4545
items.Should().HaveCount(1);
4646
items[0].Id.Should().Be(item2.Id);
4747
}
48+
49+
[Fact]
50+
public async Task NoopOnDeleteWhenEntryNotFound()
51+
{
52+
var item = new ProfileInformationEntryBuilder().WithKey("key1").WithValue("value1").Build();
53+
await profileRepository.AddAsync(item);
54+
55+
await profileRepository.DeleteAsync("SomeIdWhichHopefullyDoesNotExist");
56+
57+
(await profileRepository.GetAllAsync()).Should().HaveCount(1);
58+
}
4859
}
4960
}

0 commit comments

Comments
 (0)