예제 #1
0
        public TestsService(IEfRepository <Test> testsRepository, IEfData efData, IMappingProvider mapper)
        {
            Guard.WhenArgument(testsRepository, nameof(testsRepository)).IsNull().Throw();
            Guard.WhenArgument(efData, nameof(efData)).IsNull().Throw();
            Guard.WhenArgument(mapper, nameof(mapper)).IsNull().Throw();

            this.testsRepository = testsRepository;
            this.efData          = efData;
            this.mapper          = mapper;
        }
예제 #2
0
        public void ThrowsArgumentNullException_WhenEfData_IsNull()
        {
            // Arrange
            var     testsRepository = new Mock <IEfRepository <Test> >();
            IEfData efData          = null;
            var     mapper          = new Mock <IMappingProvider>();

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => new TestsService(testsRepository.Object, efData, mapper.Object));
        }
예제 #3
0
        public void ThrowsArgumentNullException_EfData_IsNull()
        {
            // Arrange
            var     submisionsRepoFake = new Mock <IEfRepository <Submission> >();
            var     challengeRepoFake  = new Mock <IEfRepository <Challenge> >();
            IEfData efData             = null;
            var     timeFake           = new Mock <ITimeProvider>();
            var     mapperFake         = new Mock <IMappingProvider>();

            // Act and Assert
            Assert.Throws <ArgumentNullException>(() => new SubmissionsService(submisionsRepoFake.Object, challengeRepoFake.Object, efData,
                                                                               timeFake.Object, mapperFake.Object));
        }
예제 #4
0
        public SubmissionsService(
            IEfRepository <Submission> submissionRepository,
            IEfRepository <Challenge> challengeRepository,
            IEfData efData,
            ITimeProvider timeProvider,
            IMappingProvider mapper)
        {
            Guard.WhenArgument(submissionRepository, nameof(submissionRepository)).IsNull().Throw();
            Guard.WhenArgument(challengeRepository, nameof(challengeRepository)).IsNull().Throw();
            Guard.WhenArgument(efData, nameof(efData)).IsNull().Throw();
            Guard.WhenArgument(timeProvider, nameof(timeProvider)).IsNull().Throw();
            Guard.WhenArgument(mapper, nameof(mapper)).IsNull().Throw();

            this.submissionRepository = submissionRepository;
            this.challengeRepository  = challengeRepository;
            this.efData       = efData;
            this.timeProvider = timeProvider;
            this.mapper       = mapper;
        }
예제 #5
0
        public ChallengesService(
            IEfRepository <Challenge> challengesRepository,
            IEfRepository <Test> testsRepository,
            IEfRepository <FileDecription> fileDescriptionRepository,
            IEfRepository <Category> categoriesRepository,
            IEfData efData,
            IMappingProvider mapper)
        {
            Guard.WhenArgument(challengesRepository, nameof(challengesRepository)).IsNull().Throw();
            Guard.WhenArgument(testsRepository, nameof(testsRepository)).IsNull().Throw();
            Guard.WhenArgument(categoriesRepository, nameof(categoriesRepository)).IsNull().Throw();
            Guard.WhenArgument(fileDescriptionRepository, nameof(fileDescriptionRepository)).IsNull().Throw();
            Guard.WhenArgument(efData, nameof(efData)).IsNull().Throw();
            Guard.WhenArgument(mapper, nameof(mapper)).IsNull().Throw();

            this.challengesRepository      = challengesRepository;
            this.testsRepository           = testsRepository;
            this.categoriesRepository      = categoriesRepository;
            this.fileDescriptionRepository = fileDescriptionRepository;
            this.efData = efData;
            this.mapper = mapper;
        }
예제 #6
0
 public TestResultsService(IEfRepository <TestResult> testResultsRepository, IEfData efData)
 {
     this.testResultsRepository = testResultsRepository;
     this.efData = efData;
 }