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); }
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); }
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); }
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); }