Example #1
0
 public PeriodEndStoppedEventHandler(IPaymentLogger logger, IExecutionContext executionContext, ICompletionPaymentService completionPaymentService, ICollectionPeriodStorageService collectionPeriodStorageService)
 {
     this.logger                         = logger ?? throw new ArgumentNullException(nameof(logger));
     this.executionContext               = executionContext ?? throw new ArgumentNullException(nameof(executionContext));
     this.completionPaymentService       = completionPaymentService ?? throw new ArgumentNullException(nameof(completionPaymentService));
     this.collectionPeriodStorageService = collectionPeriodStorageService ?? throw new ArgumentNullException(nameof(collectionPeriodStorageService));
 }
        internal CollectionPeriodStorageServiceFixture()
        {
            var random  = new Random();
            var fixture = new Fixture();

            academicYear   = (short)random.Next(2021, 2060);
            period         = (byte)random.Next(1, 14);
            completionDate = fixture.Create <DateTime>();

            existingCollectionPeriod = fixture.Create <CollectionPeriodModel>();
            existingCollectionPeriod.AcademicYear = academicYear;
            existingCollectionPeriod.Period       = period;

            logger  = new Mock <IPaymentLogger>();
            context = new ProviderPaymentsDataContext(new DbContextOptionsBuilder <ProviderPaymentsDataContext>().UseInMemoryDatabase("test", new InMemoryDatabaseRoot()).Options);
            sut     = new CollectionPeriodStorageService(context, logger.Object);
        }