Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace CODODN
- {
- public interface IRepository
- {
- string SomethingYouNeed { get; set; }
- }
- public class repository : IRepository
- {
- public string SomethingYouNeed
- {
- get
- {
- return "Production Item";
- }
- set
- {
- throw new NotImplementedException();
- }
- }
- }
- public class my_service
- {
- IRepository _repo;
- public my_service() : this(null){}
- public my_service (IRepository repo)
- {
- _repo = repo ?? new repository();
- }
- }
- public class test_service_class
- {
- //inject the repo
- public void before_each()
- {
- var s = new my_service(new fake_repository());
- }
- }
- public class fake_repository : IRepository
- {
- public string SomethingYouNeed
- {
- get
- {
- return "My Test Doo-Dad";
- }
- set
- {
- throw new NotImplementedException();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment