Guest User

Untitled

a guest
May 27th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace CODODN
  7. {
  8. public interface IRepository
  9. {
  10. string SomethingYouNeed { get; set; }
  11. }
  12.  
  13. public class repository : IRepository
  14. {
  15. public string SomethingYouNeed
  16. {
  17. get
  18. {
  19. return "Production Item";
  20. }
  21. set
  22. {
  23. throw new NotImplementedException();
  24. }
  25. }
  26. }
  27.  
  28. public class my_service
  29. {
  30. IRepository _repo;
  31.  
  32. public my_service() : this(null){}
  33.  
  34. public my_service (IRepository repo)
  35. {
  36. _repo = repo ?? new repository();
  37. }
  38. }
  39.  
  40. public class test_service_class
  41. {
  42.  
  43. //inject the repo
  44.  
  45. public void before_each()
  46. {
  47. var s = new my_service(new fake_repository());
  48. }
  49. }
  50.  
  51. public class fake_repository : IRepository
  52. {
  53.  
  54. public string SomethingYouNeed
  55. {
  56. get
  57. {
  58. return "My Test Doo-Dad";
  59. }
  60. set
  61. {
  62. throw new NotImplementedException();
  63. }
  64. }
  65. }
  66. }
Add Comment
Please, Sign In to add comment