fix(sms): S2 review — add DeleteSmsConfigurationAsync + schema/repo tests + doc nit
This commit is contained in:
@@ -226,6 +226,34 @@ public class NotificationRepositoryTests : IDisposable
|
||||
Assert.Null(await _repository.GetNotificationListByIdAsync(list.Id));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AddSmsConfiguration_RoundTrips()
|
||||
{
|
||||
var sms = new SmsConfiguration("ACtest123", "+14155550100");
|
||||
await _repository.AddSmsConfigurationAsync(sms);
|
||||
await _repository.SaveChangesAsync();
|
||||
|
||||
var loaded = await _repository.GetSmsConfigurationAsync();
|
||||
Assert.NotNull(loaded);
|
||||
Assert.Equal("ACtest123", loaded!.AccountSid);
|
||||
Assert.Equal("+14155550100", loaded.FromNumber);
|
||||
|
||||
// Update a field and verify GetAllSmsConfigurationsAsync reflects it.
|
||||
loaded.FromNumber = "+14155550199";
|
||||
await _repository.UpdateSmsConfigurationAsync(loaded);
|
||||
await _repository.SaveChangesAsync();
|
||||
|
||||
var all = await _repository.GetAllSmsConfigurationsAsync();
|
||||
Assert.Single(all);
|
||||
Assert.Equal("+14155550199", all[0].FromNumber);
|
||||
|
||||
// Delete and verify removal.
|
||||
await _repository.DeleteSmsConfigurationAsync(loaded.Id);
|
||||
await _repository.SaveChangesAsync();
|
||||
|
||||
Assert.Null(await _repository.GetSmsConfigurationAsync());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task NotificationList_PersistsType()
|
||||
{
|
||||
|
||||
@@ -53,6 +53,7 @@ public class DbContextTests : IDisposable
|
||||
Assert.NotNull(_context.NotificationLists);
|
||||
Assert.NotNull(_context.NotificationRecipients);
|
||||
Assert.NotNull(_context.SmtpConfigurations);
|
||||
Assert.NotNull(_context.SmsConfigurations);
|
||||
Assert.NotNull(_context.SharedScripts);
|
||||
Assert.NotNull(_context.LdapGroupMappings);
|
||||
Assert.NotNull(_context.SiteScopeRules);
|
||||
|
||||
Reference in New Issue
Block a user