public void Init() { mock = new Mock<IStorageRepository>(); bathRoomWithoutFurniture = new Room() { CreationDate = now, Name = "Bathroom", Furnitures = new Dictionary<string, int>() }; mock.Setup(c => c.CreateRoom(bathRoomWithoutFurniture.Name, now)).Returns(bathRoomWithoutFurniture); mock.Setup(c => c.GetRoomByName(bathRoomWithoutFurniture.Name)).Returns(bathRoomWithoutFurniture); livingRoomWithFurniture = new Room { Name = "LivingRoom", CreationDate = now, Furnitures = (new List<Tuple<string, int>> { new Tuple<string, int>("Table", 1), new Tuple<string, int>("Chair", 2) }).ToDictionary(k => k.Item1, v => v.Item2) }; mock.Setup(c => c.GetRoomByName("LivingRoom")).Returns(livingRoomWithFurniture); repository = mock.Object; service = new StorageService(repository); }
public static void QueryRoomsInit(TestContext testContext) { _now = DateTime.Now.Date; _tomorrow = _now.AddDays(1); _yesterday = _now.AddDays(-1); Service = new StorageService(new StorageMemoryRepositoryStub()); var room = Service.EnsureRoom(_testRoom, _yesterday); Service.CreateFurniture("Desk", room.Name, _now); Service.CreateFurniture("Chair", room.Name, _tomorrow); var anotherRoom = Service.EnsureRoom(_anotherTestRoom, _yesterday); Service.CreateFurniture("Desk", anotherRoom.Name, _now); Service.CreateFurniture("Chair", anotherRoom.Name, _tomorrow); }
public StorageBaseTest() { Service = new StorageService(new StorageMemoryRepositoryStub()); }
public RoomController(IStorageRepository repository) { _service = new StorageService(repository); }