Example #1
0
        public void CanCreateFurniture()
        {
            HomeState stateHolder = new HomeState();
            DateTime date = new DateTime(2015, 01, 01);
            const string roomName = "bedroom";
            const string furnitureName = "sofa";
            stateHolder.CreateFurniture(furnitureName, roomName, date);
            Assert.AreEqual(1, stateHolder.GetRoomsList(date).Count);
            Assert.AreEqual(roomName, stateHolder.GetRoomsList(date).First().Name);
            Assert.AreEqual(1, stateHolder.GetRoomsList(date).First().GetFurnitures().Count);
            Assert.AreEqual(furnitureName, stateHolder.GetRoomsList(date).First().GetFurnitures().First().Type);

            stateHolder.CreateFurniture(furnitureName, roomName, date);
            Assert.AreEqual(1, stateHolder.GetRoomsList(date).Count);
            Assert.AreEqual(roomName, stateHolder.GetRoomsList(date).First().Name);
            Assert.AreEqual(2, stateHolder.GetRoomsList(date).First().GetFurnitures().Count);
            Assert.AreEqual(furnitureName, stateHolder.GetRoomsList(date).First().GetFurnitures().First().Type);
            Assert.AreEqual(furnitureName, stateHolder.GetRoomsList(date).First().GetFurnitures().Last().Type);
        }
Example #2
0
        public void CanGetRoomsList()
        {
            HomeState stateHolder = new HomeState();
            DateTime date = new DateTime(2015, 01, 01);
            const string roomName = "bedroom";
            stateHolder.CreateRoom(roomName, date);
            var list = stateHolder.GetRoomsList(date);
            Assert.IsNotNull(list);
            Assert.AreEqual(1, list.Count);

            stateHolder.CreateRoom(roomName, date);
            list = stateHolder.GetRoomsList(date);
            Assert.IsNotNull(list);
            Assert.AreEqual(2, list.Count);

            DateTime anotherDate = new DateTime(2014, 10, 11);
            stateHolder.CreateRoom(roomName, anotherDate);
            list = stateHolder.GetRoomsList(date);
            Assert.IsNotNull(list);
            Assert.AreEqual(2, list.Count);
            list = stateHolder.GetRoomsList(anotherDate);
            Assert.IsNotNull(list);
            Assert.AreEqual(1, list.Count);
        }