public async Task <ActionResult> RemoveTemplate(string name) { if (!ModelState.IsValid) { NotifyModelStateErrors(); return(ModelStateErrorResponseError()); } await _emailAppService.RemoveTemplate(name); return(ResponsePutPatch()); }
public async Task Should_Remove_Template() { var command = EmailFaker.GenerateTemplateViewModel().Generate(); var result = await _emailAppService.SaveTemplate(command); result.Should().BeTrue(); result = await _emailAppService.RemoveTemplate(command.Name); result.Should().BeTrue(becauseArgs: _notifications.GetNotificationsByKey()); _database.Templates.FirstOrDefault(f => f.Name == command.Name).Should().BeNull(); }