Esempio n. 1
0
        private static ProblemItem[] GetProblems(int page, int pageSize, ITaskNameRepository taskRepository, bool showClosed)
        {
            var specification = showClosed ? (ISpecification <Task>)AllTasksSpecification.Instance : OpenedTasksSpecification.Instance;
            var tasks         = taskRepository.GetTasks(specification, page, pageSize)
                                .Select(o => new ProblemItem
            {
                Id       = o.Id,
                Name     = o.Name,
                IsOpened = o.IsOpened
            }).ToArray();

            return(tasks);
        }
Esempio n. 2
0
        public void SetUp()
        {
            var unitOfWorkFactory = MockRepository.GenerateMock <IUnitOfWorkFactory>();
            var unitOfWork        = MockRepository.GenerateMock <IUnitOfWork>();

            _taskRepository         = MockRepository.GenerateMock <ITaskNameRepository>();
            _submitResultRepository = MockRepository.GenerateMock <ISubmitResultRepository>();

            unitOfWork.Stub(o => o.TaskNameRepository).Return(_taskRepository);
            unitOfWork.Stub(o => o.SubmitResultRepository).Return(_submitResultRepository);

            unitOfWorkFactory.Stub(o => o.GetUnitOfWork()).Return(unitOfWork);

            _service = new ProblemsService(unitOfWorkFactory);
        }
Esempio n. 3
0
        public void SetUp()
        {
            var factory    = MockRepository.GenerateMock <IUnitOfWorkFactory>();
            var unitOfWork = MockRepository.GenerateMock <IUnitOfWork>();

            factory.Stub(o => o.GetUnitOfWork(Arg <bool> .Is.Anything)).Return(unitOfWork);

            _taskRepository         = MockRepository.GenerateMock <ITaskNameRepository>();
            _submitResultRepository = MockRepository.GenerateMock <ISubmitResultRepository>();
            unitOfWork.Stub(o => o.GetRepository <ITaskNameRepository>()).Return(_taskRepository);
            unitOfWork.Stub(o => o.GetRepository <ISubmitResultRepository>()).Return(_submitResultRepository);

            var principal = MockRepository.GenerateMock <IPrincipal>();

            _service = new SubmitSolutionService(factory, principal);
        }
Esempio n. 4
0
        public void SetUp()
        {
            var unitOfWorkFactory = MockRepository.GenerateMock <IUnitOfWorkFactory>();
            var unitOfWork        = MockRepository.GenerateMock <IUnitOfWork>();

            _submitResultRepository = MockRepository.GenerateMock <ISubmitResultRepository>();
            var languageRepository = MockRepository.GenerateMock <ILanguageRepository>();

            languageRepository.Stub(o => o.GetLanguages()).Return(new[] { new Language() });

            _taskRepository = MockRepository.GenerateMock <ITaskNameRepository>();
            _userRepository = MockRepository.GenerateMock <IUserRepository>();

            unitOfWork.Stub(o => o.GetRepository <ISubmitResultRepository>()).Return(_submitResultRepository);
            unitOfWork.Stub(o => o.GetRepository <ILanguageRepository>()).Return(languageRepository);
            unitOfWork.Stub(o => o.GetRepository <ITaskNameRepository>()).Return(_taskRepository);
            unitOfWork.Stub(o => o.GetRepository <IUserRepository>()).Return(_userRepository);

            unitOfWorkFactory.Stub(o => o.GetUnitOfWork(Arg <bool> .Is.Anything)).Return(unitOfWork);

            var principal = MockRepository.GenerateMock <IPrincipal>();

            _service = new SubmitQueueService(unitOfWorkFactory, principal);
        }