public async Task <Guid> HandleAsync(CreateNotificationApplication command)
        {
            var authority = command.CompetentAuthority;

            var notification = await notificationApplicationFactory.CreateNew(command.NotificationType, authority);

            notificationApplicationRepository.Add(notification);

            await context.SaveChangesAsync();

            var facilityCollection = new FacilityCollection(notification.Id);
            var carrierCollection  = new CarrierCollection(notification.Id);
            var producerCollection = new ProducerCollection(notification.Id);

            facilityRepository.Add(facilityCollection);
            carrierRepository.Add(carrierCollection);
            producerRepository.Add(producerCollection);

            await context.SaveChangesAsync();

            return(notification.Id);
        }
Ejemplo n.º 2
0
        public async Task CanCreateNew()
        {
            var notification = await factory.CreateNew(NotificationType.Recovery, UKCompetentAuthority.England);

            Assert.IsType <NotificationApplication>(notification);
        }