public void TestFilterBySizeWithOutMinimum() { var mock = new Mock<RoomCrud>(); mock.Setup(x => x.Read()).Returns(rooms); var roomHandler = new RoomHandler(mock.Object); var result = roomHandler.Filter(8, false); var testResult = rooms.Where(room => room.Size == 8); CollectionAssert.AreEqual(testResult.ToList(), result.ToList()); }
public void TestFilterByEquipment() { var mock = new Mock<RoomCrud>(); mock.Setup(x => x.Read()).Returns(rooms); var roomHandler = new RoomHandler(mock.Object); var filterList = new List<string> { "Stol", "Bord" }; var result = roomHandler.Filter(filterList); //Returns only the rooms containing all the filter strings var testResult = rooms.Where( room => room.Equipments.Select( equip => equip.Name).Intersect(filterList).Count() == filterList.Count).ToList(); CollectionAssert.AreEqual(testResult.ToList(), result.ToList()); }