You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.5 KiB

11 years ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Rhino.Mocks;
  7. using Sevomin.Models;
  8. using Sevomin.Models.Repositories;
  9. namespace Sevomin.Tests
  10. {
  11. public class FakeJobRepository
  12. {
  13. private static IJobRepository _JobRepository;
  14. private static IQueryable<Job> _Job;
  15. static FakeJobRepository()
  16. {
  17. Init();
  18. }
  19. internal static void Init()
  20. {
  21. //_Job = (new List<Job>() {
  22. // new Job{ id = 1, Name = "A", TaskDefinitions = new List<TaskDefinition>()},
  23. // new Job{ id = 2, Name = "B", TaskDefinitions = new List<TaskDefinition>() }
  24. //}).AsQueryable();
  25. //_JobRepository = MockRepository.GenerateStub<IJobRepository>();
  26. //_JobRepository.Stub(x => x.Find(Arg<long>.Is.Anything))
  27. // .WhenCalled(x => x.ReturnValue = _Job.FirstOrDefault(y => y.id == (long)x.Arguments[0]))
  28. // .Return(new Job());
  29. //_JobRepository.Stub(x => x.ListAll()).Return(_Job);
  30. //_JobRepository.Stub(x => x.FindByUsername("new-mission"))
  31. // .Return(null);
  32. //_JobRepository.Stub(x => x.FindByUsername(Arg<string>.Is.Anything))
  33. // .Return(new Job() { id = 1, Username = "test", Name = "A", TaskDefinitions = new List<TaskDefinition>() });
  34. }
  35. internal static IJobRepository Instance()
  36. {
  37. return _JobRepository;
  38. }
  39. }
  40. }