public void SetupFixture() { FakeDi.Register(); _config = Config.Instance as FakeConfig; var repoUnit = new RepoUnit(); Ioc.RegisterInstance<RepoUnit>(repoUnit); _rooms.Values.ToList().ForEach(repoUnit.Room.Save); _roomService = new RoomService(repoUnit); Ioc.RegisterInstance<RoomService>(_roomService); }
public void Setup() { FakeDi.Register(); _rooms = new List<Room> { new Room {Name = "First room", Color = 1, NumberOfPlaces = 78}, new Room {Name = "Second room", Color = 5, NumberOfPlaces = 12}, new Room {Name = "Third room", Color = 2, NumberOfPlaces = 6}, }; var mockRepository = new Mock<IRoomRepository>(); mockRepository.Setup(m => m.Load()).Returns(_rooms.AsQueryable()); Ioc.RegisterInstance<IRoomRepository>(mockRepository.Object); _roomService = Ioc.Resolve<RoomService>(); }
public RoomController(RoomService service) { _service = service; }