public async Task <BookingstatusResponse> GetBookingStatus(Bookingstatus ObjBookingstatus) { BookingstatusResponse ObjBookingstatusResponse = new BookingstatusResponse(); var events = await _eventBookingRepository.GetBookingStatusDB(ObjBookingstatus); if (events.Count > 0) { for (int i = 0; i < events.Count; i++) { statusResponse ObjResponse = new statusResponse(); ObjResponse.UserID = events[i].UserID; ObjResponse.BookingID = events[i].BookingID; ObjResponse.Status = events[i].Status; ObjResponse.EventID = events[i].EventID; ObjResponse.EventName = events[i].EventName; ObjResponse.EventTimings = events[i].EventTimings; ObjResponse.EventStatus = events[i].EventStatus; ObjResponse.EventDetails = events[i].EventDetails; ObjBookingstatusResponse.response.Add(ObjResponse); } ObjBookingstatusResponse.ResponseMessage = "Booking Status found successfully"; } else { ObjBookingstatusResponse.ResponseMessage = "No Bookings found"; } return(ObjBookingstatusResponse); }
public async Task GetBookingStatus_ShouldReturnBookingStatusifpresent() { //Arrange string name = "monica", emailID = "", phonenum = ""; Bookingstatus ObjBookingstatus = new Bookingstatus(); ObjBookingstatus.UserID = "123"; ObjBookingstatus.UserName = name; ObjBookingstatus.Email = emailID; ObjBookingstatus.PhoneNum = phonenum; statusResponse ObjResponse = new statusResponse(); ObjResponse.EventID = "1"; ObjResponse.EventName = "IPL"; ObjResponse.EventStatus = "Open"; ObjResponse.EventTimings = "7 PM"; ObjResponse.EventDetails = "MI vs CSK"; ObjResponse.UserID = "222"; ObjResponse.BookingID = "222"; ObjResponse.Status = "Booking Confirmed"; BookingstatusResponse objres = new BookingstatusResponse(); objres.response.Add(ObjResponse); objres.ResponseMessage = "Booking Status found successfully"; List <DBBookingstatusResponse> obj = new List <DBBookingstatusResponse>(); DBBookingstatusResponse objresp = new DBBookingstatusResponse(); objresp.EventID = "1"; objresp.EventName = "IPL"; objresp.EventStatus = "Open"; objresp.EventTimings = "7 PM"; objresp.EventDetails = "MI vs CSK"; objresp.UserID = "222"; objresp.BookingID = "222"; objresp.Status = "Booking Confirmed"; obj.Add(objresp); string query = "sp_CustBookingStatus @userID,@userName,@EmailID,@PhoneNum"; _eventDBMock.Setup(x => x.ExecuteAsyncTableProcedure <DBBookingstatusResponse>(It.IsAny <SqlParameter[]>(), query)).ReturnsAsync(obj); //Act var customer = await _eventBookingRepository.GetBookingStatusDB(ObjBookingstatus); //Assert Assert.NotNull(customer); }
public async Task GetBookingStatus_ShouldReturnBookingStatusifpresent() { //Arrange string name = "monica", emailID = "", phonenum = ""; Bookingstatus ObjBookingstatus = new Bookingstatus(); ObjBookingstatus.UserID = "123"; ObjBookingstatus.UserName = name; ObjBookingstatus.Email = emailID; ObjBookingstatus.PhoneNum = phonenum; statusResponse ObjResponse = new statusResponse(); ObjResponse.EventID = "1"; ObjResponse.EventName = "IPL"; ObjResponse.EventStatus = "Open"; ObjResponse.EventTimings = "7 PM"; ObjResponse.EventDetails = "MI vs CSK"; ObjResponse.UserID = "222"; ObjResponse.BookingID = "222"; ObjResponse.Status = "Booking Confirmed"; BookingstatusResponse objres = new BookingstatusResponse(); objres.response.Add(ObjResponse); objres.ResponseMessage = "Booking Status found successfully"; List <DBBookingstatusResponse> obj = new List <DBBookingstatusResponse>(); DBBookingstatusResponse objresp = new DBBookingstatusResponse(); objresp.EventID = "1"; objresp.EventName = "IPL"; objresp.EventStatus = "Open"; objresp.EventTimings = "7 PM"; objresp.EventDetails = "MI vs CSK"; objresp.UserID = "222"; objresp.BookingID = "222"; objresp.Status = "Booking Confirmed"; obj.Add(objresp); _eventBookingService.Setup(x => x.GetBookingStatus(ObjBookingstatus)).ReturnsAsync(objres); //Act var customer = await _EventBookingController.GetBookingStatus(ObjBookingstatus); //Assert Assert.NotNull(customer); }
private statusResponse decodeIncomingData(byte[] buffer) { // Mögliche Antwort: 85 00 47 01 01 64 00 1E 00 01 50 // create response variable statusResponse rsp = new statusResponse(); int bytesToRead = buffer[0] & 0b000_1111; rsp.nodeId = buffer[1] + 1; rsp.objectId = buffer[2]; rsp.controlMode = buffer[3] & 0b0000_0011; rsp.outputState = Convert.ToBoolean(buffer[4] & 0b0000_0001); rsp.controllerState = buffer[3] & 0b0000_0110; rsp.trackingState = Convert.ToBoolean(buffer[3] & 0b0000_1000); rsp.ovpState = Convert.ToBoolean(buffer[3] & 0b0001_0000); rsp.ocpState = Convert.ToBoolean(buffer[3] & 0b0010_0000); rsp.oppState = Convert.ToBoolean(buffer[3] & 0b0100_0000); rsp.otpState = Convert.ToBoolean(buffer[3] & 0b1000_0000); int receivedVoltageValue = Convert.ToInt16("0x" + buffer[5].ToString("X2") + buffer[6].ToString("X2"), 16); int receivedCurrentValue = Convert.ToInt16("0x" + buffer[7].ToString("X2") + buffer[8].ToString("X2"), 16); // convert to actual voltage and round last digit to nearest five (seems to be done this way on the PSU itself) rsp.actualVoltage = (float)(Math.Round(((float)receivedVoltageValue * MAX_VOLTAGE / 256) / 5.0) * 5) / 100; rsp.actualCurrent = (float)receivedCurrentValue * MAX_CURRENT / 25600; if (rsp.nodeId == 1) { statusNode1 = rsp; } else { statusNode2 = rsp; } return(rsp); }
public getStatusResponse(statusResponse status) { this.status = status; }