public RoomOverviewWindow()
        {
            InitializeComponent();

            var connection = SqliteDatabaseConnection.GetInstance(Properties.Settings.Default.Postgaarden);
            var equipmentCrud = new SqliteEquipmentCrud(connection);
            var roomCrud = new SqliteRoomCrud(connection, equipmentCrud);
            roomHandler = new RoomHandler(roomCrud);
        }
Пример #2
0
        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());
        }
Пример #3
0
        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());
        }