public async Task CreateReport_WrongData_PreviousIsNullPresentIsFalse(string reportName, int CurrentRoomId, string CurrentRoomName, int CurrentBuildingId, string CurrentBuildingName, int[] assetId, int[] assetTypeId, string[] assetTypeName, char[] assetLetter, bool[] present) { RoomEntity room = new RoomEntity { id = CurrentRoomId, name = CurrentRoomName, building = new BuildingEntity { id = CurrentBuildingId, name = CurrentBuildingName } }; ReportPositionPrototype positionPrototyp1 = new ReportPositionPrototype(new AssetEntity { id = assetId[0], type = new AssetTypeEntity { id = assetTypeId[0], name = assetTypeName[0], letter = assetLetter[0] } }, null, present[0]); ReportPositionPrototype positionPrototyp2 = new ReportPositionPrototype(new AssetEntity { id = assetId[1], type = new AssetTypeEntity { id = assetTypeId[1], name = assetTypeName[1], letter = assetLetter[1] } }, null, present[1]); ReportPrototype reportPrototype = new ReportPrototype(reportName, room, new ReportPositionPrototype[] { positionPrototyp1, positionPrototyp2 }); int resultInt = await apiController.createReport(reportPrototype); bool resultBool = false; if (resultInt > 0) { resultBool = true; } Assert.AreEqual(false, resultBool); }
public async Task createReport_CorrectData_OneAsset(string reportName, int CurrentRoomId, string CurrentRoomName, int CurrentBuildingId, string CurrentBuildingName, int assetId, int assetTypeId, string assetTypeName, char assetLetter, int PreviousRoomId, string PreviousRoomName, int PreviousBuildingId, string PreviousBuildingName, bool present) { RoomEntity room = new RoomEntity { id = CurrentRoomId, name = CurrentRoomName, building = new BuildingEntity { id = CurrentBuildingId, name = CurrentBuildingName } }; ReportPositionPrototype positionPrototyp = new ReportPositionPrototype(new AssetEntity { id = assetId, type = new AssetTypeEntity { id = assetTypeId, name = assetTypeName, letter = assetLetter } }, new RoomEntity { id = PreviousRoomId, name = PreviousRoomName, building = new BuildingEntity { id = PreviousBuildingId, name = PreviousBuildingName } }, present); ReportPrototype reportPrototype = new ReportPrototype(reportName, room, new ReportPositionPrototype[] { positionPrototyp }); int resultInt = await apiController.createReport(reportPrototype); bool resultBool = false; if (resultInt > 0) { resultBool = true; } Assert.AreEqual(true, resultBool); }
/// <summary> /// Konstruktor klasy /// </summary> /// <param name="scanningRoom">pokoj w ktorym odbywa sie skanowanie</param> /// <param name="assetEntity">zeskanowany srodek trwaly</param> /// <param name="assetRoom">pokoj z ktorego pochodzi srodek trwaly</param> public ScanPosition(AssetEntity assetEntity, RoomEntity assetRoom, RoomEntity scanningRoom) { if (assetRoom != null) { AssetRoomId = assetRoom.id; AssetRoomName = assetRoom.name; } else { AssetRoomId = null; AssetRoomName = "brak"; } reportPositionPrototype = new ReportPositionPrototype(assetEntity, assetRoom, false); AssetEntity = assetEntity; ScannedId = assetEntity.id; ScanningRoom = scanningRoom; }
/// <summary> /// Funkcja odpowiadajaca za wygenerowanie raportu po skanowaniu /// </summary> private async void GenerateRaport() { EnableView(false); ReportPositionPrototype[] reportPositionPrototype = new ReportPositionPrototype[allScaning.Count]; for (int i = 0; i < allScaning.Count; i++) { reportPositionPrototype[i] = allScaning[i].reportPositionPrototype; } int reportId = await api.createReport(new ReportPrototype($"Raport {ScanningRoom.building.name} {ScanningRoom.name}", ScanningRoom, reportPositionPrototype)); EnableView(true); if (reportId != -1) { scanningUpdate.Delete(); App.Current.MainPage = new NavigationPage(new WelcomeViewPage()); } }