11using Microsoft . EntityFrameworkCore ;
22using RustPlusBot . Domain . Guilds ;
33using RustPlusBot . Domain . Servers ;
4+ using RustPlusBot . Domain . Switches ;
45using RustPlusBot . Persistence . Maintenance ;
56
67namespace RustPlusBot . Persistence . Tests . Maintenance ;
@@ -14,10 +15,11 @@ public async Task ClearAllAsync_EmptiesEveryTable_AndKeepsSchema()
1415 await using var _ = context ;
1516 await using var __ = connection ;
1617
17- context . RustServers . Add ( new RustServer
18+ var serverA = new RustServer
1819 {
1920 GuildId = 1 , Name = "A" , Ip = "a" , Port = 1
20- } ) ;
21+ } ;
22+ context . RustServers . Add ( serverA ) ;
2123 context . RustServers . Add ( new RustServer
2224 {
2325 GuildId = 2 , Name = "B" , Ip = "b" , Port = 2
@@ -30,13 +32,18 @@ public async Task ClearAllAsync_EmptiesEveryTable_AndKeepsSchema()
3032 {
3133 GuildId = 2 , Culture = "fr"
3234 } ) ;
35+ context . SmartSwitches . Add ( new SmartSwitch
36+ {
37+ GuildId = 1 , ServerId = serverA . Id , EntityId = 10 , Name = "sw"
38+ } ) ;
3339 await context . SaveChangesAsync ( ) ;
3440
3541 var service = new DatabaseMaintenanceService ( context ) ;
3642 await service . ClearAllAsync ( ) ;
3743
3844 Assert . Empty ( await context . RustServers . ToListAsync ( ) ) ;
3945 Assert . Empty ( await context . GuildSettings . ToListAsync ( ) ) ;
46+ Assert . Empty ( await context . SmartSwitches . ToListAsync ( ) ) ;
4047
4148 // Schema still exists: a fresh insert succeeds.
4249 context . GuildSettings . Add ( new GuildSettings
0 commit comments