test domain events

This commit is contained in:
2022-10-10 12:03:54 +03:00
parent ec54d2c255
commit 0e99ae901b
13 changed files with 145 additions and 20 deletions
@@ -18,7 +18,7 @@ namespace PracticeCalendar.Infrastructure
services.AddDbContext(connectionString);
services.AddTransient<IEmailSender, FileEmailSender>();
services.AddTransient<IDomainEventService, DomainEventService>();
services.AddSingleton<IDomainEventService, DomainEventService>();
services.AddScoped(typeof(IRepository<>), typeof(EfRepository<>));
@@ -56,7 +56,9 @@ namespace PracticeCalendar.Infrastructure.Persistence
// Seed, if necessary
if (!context.PracticeEvents.Any())
{
context.PracticeEvents.Add(new PracticeEvent("Event 1", "Event 1 desc"));
context.PracticeEvents.Add(new PracticeEvent("Event 1", "Event 1 desc",
DateTime.Now.AddHours(-1),
DateTime.Now.AddHours(1)));
await context.SaveChangesAsync();
}