public void GetRoomsTest1() { // string strArchPath = "D://Users//zheny//Source//Repos//HVAC-Checker//HVAC-Checker//建筑.GDB"; string strArchPath = "C://Users//zheny//Documents//WXWork//1688853814885410//Cache//File//2020-05//建筑模型.XDB"; HVACFunction.m_archXdbPath = strArchPath; Assert.IsTrue(HVACFunction.GetRooms("前室").Count() > 0); }
public void test_getFloorDivisionOfAirTerminalsTopToBottom_pass() { using (ShimsContext.Create()) { FakeHVACFunction.roomSheetName_new = "房间"; FakeHVACFunction.ExcelPath_new = @"D:\wangT\HVAC-Checker\UnitTestHVACChecker\测试数据\测试数据_GB51251_2017_3_3_1.xlsx"; HVAC_CheckEngine.Fakes.ShimHVACFunction.GetFloors = FakeHVACFunction.GetAllFLoorsOfBuilding_new; HVAC_CheckEngine.Fakes.ShimHVACFunction.GetRoomContainAirTerminalRoom = FakeHVACFunction.GetRoomContainAirTerminal_new; HVAC_CheckEngine.Fakes.ShimHVACFunction.GetRoomsString = FakeHVACFunction.GetRooms_new; //arrange List <Room> rooms = HVACFunction.GetRooms("防烟楼梯间"); List <AirTerminal> airTerminals = HVACFunction.GetRoomContainAirTerminal(rooms[4]); //打开测试数据文件 string importExcelPath = FakeHVACFunction.ExcelPath_new; //打开数据文件 IWorkbook workbook = WorkbookFactory.Create(importExcelPath); //读取数据表格 ISheet sheet_airTerminals = workbook.GetSheet("风口"); Dictionary <AirTerminal, List <Floor> > aimResult = new Dictionary <AirTerminal, List <Floor> >(); //依次读取数据行,并根据数据内容创建房间,并加入房间集合中 for (int index = 8; index <= 10; ++index) { IRow row = (IRow)sheet_airTerminals.GetRow(index); long airTerminalId = Convert.ToInt64(row.GetCell(sheet_airTerminals.getColNumber("ID")).NumericCellValue); AirTerminal airTerminal = new AirTerminal(airTerminalId); airTerminal.systemType = row.GetCell(sheet_airTerminals.getColNumber("系统类型")).ToString(); airTerminal.m_iStoryNo = Convert.ToInt32(row.GetCell(sheet_airTerminals.getColNumber("楼层编号")).NumericCellValue); string affordStoryIdString = row.GetCell(sheet_airTerminals.getColNumber("负担的楼层")).ToString(); List <Floor> floors = FakeHVACFunction.getAllFloorsByIdString(affordStoryIdString); aimResult[airTerminal] = floors; } //打开测试数据文件 //act Dictionary <AirTerminal, List <Floor> > result = assistantFunctions.getFloorDivisionOfAirTerminalsTopToBottom(assistantFunctions.filterFloorsBetweenlowestAndHighestm_iStoryNo(1, 15), airTerminals); //assert Custom_Assert.AreDictionaryEqual(aimResult, result); } }
public void GetRoomsTest() { string type = "间"; string name = "CH/PH Stock 1"; double area = 10.0; RoomPosition roomPosition = RoomPosition.overground; string strArchPath = "D://Users//zheny//Source//Repos//HVAC-Checker//HVAC-Checker//建筑.GDB"; string strHVACPath = "D://Users//zheny//Source//Repos//HVAC-Checker//HVAC-Checker//机电.GDB"; HVACFunction hvacFunction = new HVACFunction(strArchPath, strHVACPath); HVACFunction.GetRooms(type, name, area, roomPosition); }
public void test_exceptSomeRooms_largerAndEqual_smallerAndEqual_test_pass() { using (ShimsContext.Create()) { FakeHVACFunction.ExcelPath_new = @"D:\wangT\HVAC-Checker\UnitTestHVACChecker\测试数据\测试数据_exceptSomeRoom.xlsx"; FakeHVACFunction.roomSheetName_new = "房间(包含需要除去的房间大于等于小于等于)"; HVAC_CheckEngine.Fakes.ShimHVACFunction.GetRoomsString = FakeHVACFunction.GetRooms_new; //arrange //打开测试数据文件 string importExcelPath = FakeHVACFunction.ExcelPath_new; //打开数据文件 IWorkbook workbook = WorkbookFactory.Create(importExcelPath); //读取数据表格 ISheet sheet_rooms = workbook.GetSheet("房间(包含需要除去的房间大于等于小于等于)"); List <Room> aimRooms = new List <Room>(); //依次读取数据行,并根据数据内容创建房间,并加入房间集合中 for (int index = 1; index <= sheet_rooms.LastRowNum; ++index) { IRow row = (IRow)sheet_rooms.GetRow(index); bool isNeededRoom = row.GetCell(sheet_rooms.getColNumber("是否需要")).BooleanCellValue; if (isNeededRoom) { long Id = Convert.ToInt64(row.GetCell(sheet_rooms.getColNumber("ID")).ToString()); Room room = new Room(Id); room.type = row.GetCell(sheet_rooms.getColNumber("房间类型")).StringCellValue; room.name = row.GetCell(sheet_rooms.getColNumber("房间名称")).StringCellValue; room.m_dArea = row.GetCell(sheet_rooms.getColNumber("房间面积")).NumericCellValue; room.m_eRoomPosition = (RoomPosition)row.GetCell(sheet_rooms.getColNumber("房间位置")).NumericCellValue; room.m_iNumberOfPeople = (int)row.GetCell(sheet_rooms.getColNumber("房间人数")).NumericCellValue; room.m_iStoryNo = (int)row.GetCell(sheet_rooms.getColNumber("房间楼层编号")).NumericCellValue; aimRooms.Add(room); } } //act List <Room> rooms = HVACFunction.GetRooms(""); List <assistantFunctions.exceptRoomCondition> conditions = new List <assistantFunctions.exceptRoomCondition>(); assistantFunctions.exceptRoomCondition overgroundCorridorCondition = new assistantFunctions.exceptRoomCondition(); overgroundCorridorCondition.area = 0; overgroundCorridorCondition.type = "走廊"; overgroundCorridorCondition.name = ""; overgroundCorridorCondition.roomPosition = RoomPosition.overground; overgroundCorridorCondition.areaType = assistantFunctions.exceptRoomCondition.AreaType.LargerAndEqualThan; conditions.Add(overgroundCorridorCondition); assistantFunctions.exceptRoomCondition overgroundSmallerThan500sqmCondition = new assistantFunctions.exceptRoomCondition(); overgroundSmallerThan500sqmCondition.area = 500; overgroundSmallerThan500sqmCondition.type = ""; overgroundSmallerThan500sqmCondition.name = ""; overgroundSmallerThan500sqmCondition.roomPosition = RoomPosition.overground; overgroundSmallerThan500sqmCondition.areaType = assistantFunctions.exceptRoomCondition.AreaType.SmallerAndEqualThan; conditions.Add(overgroundSmallerThan500sqmCondition); rooms = rooms.exceptSomeRooms(conditions); //assert Custom_Assert.AreListsEqual(aimRooms, rooms); } }