public void Mutation_SetIsActiveRoom_InvalidFloor_InActive() { Database.WriteAsync(realm => { realm.Add(new Floor { Id = 110, Name = "Tầng tạo ra để xóa", IsActive = false }); realm.Add(new Room { Id = 21, IsActive = true, Name = "Tên phòng", Floor = FloorBusiness.Get(110), RoomKind = RoomKindBusiness.Get(1) }); }).Wait(); SchemaHelper.ExecuteAndExpectError( "Loại phòng thuộc tầng đã bị vô hiệu hóa. Không thể kích hoạt", @"/_GraphQL/Room/mutation.setIsActiveRoom.gql", new { id = 21, isActive = true }, p => p.PermissionManageMap = true ); }
public void Mutation_UpdateServicesDetail_InvalidService() { Database.WriteAsync(realm => realm.Add(new ServicesDetail { Id = 20, Booking = BookingBusiness.Get(1), Service = ServiceBusiness.Get(1), Number = 10 })).Wait(); SchemaHelper.ExecuteAndExpectError( "Mã dịch vụ không tồn tại", @"/_GraphQL/ServicesDetail/mutation.updateServicesDetail.gql", new { input = new { id = 20, number = 2, service = new { id = 100 } } }, p => p.PermissionCleaning = true ); }
public void Mutation_UpdateService_InvalidId_InActive() { Database.WriteAsync(realm => realm.Add(new Service { Id = 31, IsActive = true, Name = "Tên dịch vụ", Unit = "Đơn vị" })).Wait(); SchemaHelper.ExecuteAndExpectError( "Dịch vụ 31 đã ngừng cung cấp. Không thể cập nhật/xóa!", @"/_GraphQL/Service/mutation.updateService.gql", new { input = new { id = 31, name = "Tên dịch vụ", unitRate = 30000, unit = "Đơn vị tính" } }, p => p.PermissionManageService = true ); }
public void Mutation_AddBookingToBill_InvalidBill() { Database.WriteAsync(realm => realm.Add(new Room { Id = 201, IsActive = true, Name = "Tên phòng", Floor = FloorBusiness.Get(1), RoomKind = RoomKindBusiness.Get(1) })).Wait(); SchemaHelper.ExecuteAndExpectError( "Mã hóa đơn không tồn tại", @"/_GraphQL/Booking/mutation.addBookingToBill.gql", new { booking = new { bookCheckInTime = DateTimeOffset.Now.AddDays(1), bookCheckOutTime = DateTimeOffset.Now.AddDays(2), room = new { id = 201 }, listOfPatrons = new[] { new { id = 1 } } }, bill = new { id = 1 } }, p => p.PermissionManageRentingRoom = true ); }
public void Mutation_UpdateRoomKind_InvalidId_InActive() { Database.WriteAsync(realm => realm.Add(new RoomKind { Id = 33, Name = "Tên loại phòng", AmountOfPeople = 1, NumberOfBeds = 1, IsActive = false })).Wait(); SchemaHelper.ExecuteAndExpectError( "Loại phòng có Id: 33 đã ngừng cung cấp. Không thể cập nhật/xóa!", @"/_GraphQL/RoomKind/mutation.updateRoomKind.gql", new { input = new { id = 33, name = "Loại 2", numberOfBeds = 2, amountOfPeople = 2 } }, p => p.PermissionManageMap = true ); }
public void Mutation_CreateEmployee_InvalidPosition() { SchemaHelper.ExecuteAndExpectError( "Mã chức vụ không tồn tại", @"/_GraphQL/Employee/mutation.createEmployee.gql", new { input = new { id = "thaotram", password = "******", name = "Tên nhân viên", identityCard = "12345678", gender = true, email = "*****@*****.**", phoneNumber = "123456789", address = "164/54", birthdate = "04-04-1996", startingDate = "10-10-2015", position = new { id = 100 } } }, p => p.PermissionManageEmployee = true ); }
public void Mutation_AddBookingToBill_InvalidRoom() { SchemaHelper.ExecuteAndExpectError( "Mã phòng không tồn tại", @"/_GraphQL/Booking/mutation.addBookingToBill.gql", new { booking = new { bookCheckInTime = DateTimeOffset.Now.AddDays(1), bookCheckOutTime = DateTimeOffset.Now.AddDays(2), room = new { id = 100 }, listOfPatrons = new[] { new { id = 1 } } }, bill = new { id = 1 } }, p => p.PermissionManageRentingRoom = true ); }
public void Mutation_CreateBill_InvalidRoom_InActive() { Database.WriteAsync(realm => realm.Add(new Room { Id = 121, IsActive = false, Name = "Tên phòng", Floor = FloorBusiness.Get(1), RoomKind = RoomKindBusiness.Get(1) })).Wait(); SchemaHelper.ExecuteAndExpectError( "Phòng 121 đã ngừng hoạt động", @"/_GraphQL/Bill/mutation.createBill.gql", new { bookings = new[] { new { bookCheckInTime = DateTimeOffset.Now.AddDays(1), bookCheckOutTime = DateTimeOffset.Now.AddDays(2), room = new { id = 121 }, listOfPatrons = new[] { new { id = 1 } } } }, bill = new { patron = new { id = 1 } } }, p => p.PermissionManageRentingRoom = true ); }
public void Mutation_UpdatePosition_InvalidEmployee() { SchemaHelper.ExecuteAndExpectError( "Không thể cập nhật/xóa. Chức vụ đang có nhân viên sử dụng", @"/_GraphQL/Position/mutation.updatePosition.gql", new { input = new { id = 1, name = "Tên quyền", permissionCleaning = true, permissionGetAccountingVoucher = true, permissionGetHouseKeeping = true, permissionGetMap = true, permissionGetPatron = true, permissionGetRate = true, permissionGetService = true, permissionManageEmployee = true, permissionManageRentingRoom = false, permissionManageMap = true, permissionManagePatron = true, permissionManagePatronKind = true, permissionManagePosition = true, permissionManageRate = true, permissionManageService = true } }, p => p.PermissionManagePosition = true ); }
public void Mutation_BookAndCheckIn_InvalidRoom_Overlap() { Database.WriteAsync(realm => realm.Add(new Room { Id = 111, IsActive = true, Name = "Tên phòng", Floor = FloorBusiness.Get(1), RoomKind = RoomKindBusiness.Get(1) })).Wait(); SchemaHelper.ExecuteAndExpectError( "Có booking trùng nhau", @"/_GraphQL/Bill/mutation.bookAndCheckIn.gql", new { bookings = new[] { new { bookCheckOutTime = DateTimeOffset.Now.AddDays(2), room = new { id = 111 }, listOfPatrons = new[] { new { id = 1 } } } }, bill = new { patron = new { id = 1 } } }, p => p.PermissionManageRentingRoom = true ); }
public void Mutation_CreateBill_InvalidPatron() { SchemaHelper.ExecuteAndExpectError( "Mã khách hàng không tồn tại", @"/_GraphQL/Bill/mutation.createBill.gql", new { bookings = new[] { new { bookCheckInTime = DateTimeOffset.Now.AddDays(1), bookCheckOutTime = DateTimeOffset.Now.AddDays(2), room = new { id = 1 }, listOfPatrons = new[] { new { id = 1 } } } }, bill = new { patron = new { id = 100 } } }, p => p.PermissionManageRentingRoom = true ); }
public void Mutation_CreateRoom_InvalidFloor_InActive() { Database.WriteAsync(realm => realm.Add(new Floor { Id = 101, Name = "Tầng tạo ra để xóa", IsActive = false })).Wait(); SchemaHelper.ExecuteAndExpectError( "Tầng có ID: 101 đã ngưng hoại động", @"/_GraphQL/Room/mutation.createRoom.gql", new { input = new { name = "Phòng 2", roomKind = new { id = 1 }, floor = new { id = 101 } } }, p => p.PermissionManageMap = true ); }
public void Mutation_UpdateRoom_InvalidRoom_InActive() { Database.WriteAsync(realm => realm.Add(new Room { Id = 35, IsActive = false, Name = "Tên phòng", Floor = FloorBusiness.Get(1), RoomKind = RoomKindBusiness.Get(1) })).Wait(); SchemaHelper.ExecuteAndExpectError( "Phòng 35 đã ngưng hoại động. Không thể cập nhật/xóa!", @"/_GraphQL/Room/mutation.updateRoom.gql", new { input = new { id = 35, name = "Phòng 2", roomKind = new { id = 1 }, floor = new { id = 1 } } }, p => p.PermissionManageMap = true ); }
public void Mutation_UpdateRoom_InvalidRoomKind() { Database.WriteAsync(realm => realm.Add(new Room { Id = 33, IsActive = true, Name = "Tên phòng", Floor = FloorBusiness.Get(1), RoomKind = RoomKindBusiness.Get(1) })).Wait(); SchemaHelper.ExecuteAndExpectError( "Mã loại phòng không tồn tại", @"/_GraphQL/Room/mutation.updateRoom.gql", new { input = new { id = 33, name = "Phòng 2", roomKind = new { id = 100 }, floor = new { id = 1 } } }, p => p.PermissionManageMap = true ); }
public void Mutation_ConfirmCleaned_InvalidEmployee() { Database.WriteAsync(realm => { realm.Add(new Employee { Id = "nhanvien_60", Address = "Địa chỉ", IsActive = true, Birthdate = DateTimeOffset.Now, Email = "*****@*****.**", Gender = true, Name = "Quản trị viên", IdentityCard = "123456789", Password = CryptoHelper.Encrypt("12345678"), PhoneNumber = "+84 0123456789", Position = PositionBusiness.Get(1), StartingDate = DateTimeOffset.Now }); realm.Add(new HouseKeeping { Id = 22, Status = (int)HouseKeeping.StatusEnum.Cleaning, Employee = EmployeeBusiness.Get("nhanvien_60"), Booking = BookingBusiness.Get(1) }); }).Wait(); SchemaHelper.ExecuteAndExpectError( "Nhân viên không được phép xác nhận dọn", @"/_GraphQL/HouseKeeping/mutation.confirmCleaned.gql", new { id = 22 }, p => p.PermissionCleaning = true ); }
public void Mutation_UpdatePosition_InvalidId() { SchemaHelper.ExecuteAndExpectError( "Chức vụ có ID: 100 không tồn tại", @"/_GraphQL/Position/mutation.updatePosition.gql", new { input = new { id = 100, name = "Tên quyền", permissionCleaning = true, permissionGetAccountingVoucher = true, permissionGetHouseKeeping = true, permissionGetMap = true, permissionGetPatron = true, permissionGetRate = true, permissionGetService = true, permissionManageEmployee = true, permissionManageRentingRoom = false, permissionManageMap = true, permissionManagePatron = true, permissionManagePatronKind = true, permissionManagePosition = true, permissionManageRate = true, permissionManageService = true } }, p => p.PermissionManagePosition = true ); }
public void Mutation_CreatePatron_InvalidPatronKind() { SchemaHelper.ExecuteAndExpectError( "Mã loại khách hàng không tồn tại", @"/_GraphQL/Patron/mutation.createPatron.gql", new { input = new { identification = "1234243543", name = "Tên khách hàng", email = "email khách hàng", gender = true, birthdate = DateTimeOffset.FromUnixTimeSeconds(857293200), residence = "Hộ khẩu", domicile = "Nguyên quán", listOfPhoneNumbers = new[] { "1234", "123445" }, nationality = "Quốc tịch", company = "BOSCH", note = "Ghi chú", patronKind = new { id = 100 } } }, p => p.PermissionManagePatron = true ); }
public void Mutation_UpdateRate_InvalidId() { SchemaHelper.ExecuteAndExpectError( "Giá có Id: 100 không hợp lệ!", @"/_GraphQL/Rate/mutation.updateRate.gql", new { input = new { id = 100, dayRate = 5, nightRate = 5, weekRate = 5, monthRate = 5, lateCheckOutFee = 5, earlyCheckInFee = 5, effectiveStartDate = DateTimeOffset.MinValue, roomKind = new { id = 1 } } }, p => p.PermissionManageRate = true ); }
public void Mutation_CreateVolatilityRate_InvalidRoomKind() { SchemaHelper.ExecuteAndExpectError( "Mã loại phòng không tồn tại", @"/_GraphQL/VolatilityRate/mutation.createVolatilityRate.gql", new { input = new { dayRate = 1, nightRate = 1, weekRate = 1, monthRate = 1, lateCheckOutFee = 1, earlyCheckInFee = 1, effectiveStartDate = "0001-01-01T00:00:00+00:00", effectiveEndDate = "0001-01-01T00:00:00+00:00", effectiveOnMonday = true, effectiveOnTuesday = true, effectiveOnWednesday = true, effectiveOnThursday = true, effectiveOnFriday = true, effectiveOnSaturday = true, effectiveOnSunday = true, roomKind = new { id = 100 } } }, p => p.PermissionManageRate = true ); }
public void Mutation_UpdateRate_InvalidRoomKind() { Database.WriteAsync(realm => realm.Add(new Rate { Id = 21, RoomKind = RoomKindBusiness.Get(1), Employee = EmployeeBusiness.Get("admin") })).Wait(); SchemaHelper.ExecuteAndExpectError( "Mã loại phòng không tồn tại", @"/_GraphQL/Rate/mutation.updateRate.gql", new { input = new { id = 21, dayRate = 5, nightRate = 5, weekRate = 5, monthRate = 5, lateCheckOutFee = 5, earlyCheckInFee = 5, effectiveStartDate = DateTimeOffset.MinValue, roomKind = new { id = 100 } } }, p => p.PermissionManageRate = true ); }
public void Mutation_AddBookingToBill_InvalidRoom_Empty() { SchemaHelper.ExecuteAndExpectError( "Phòng đã được đặt hoặc đang được sử dụng", @"/_GraphQL/Booking/mutation.addBookingToBill.gql", new { booking = new { bookCheckInTime = DateTimeOffset.Now.AddDays(1), bookCheckOutTime = DateTimeOffset.Now.AddDays(2), room = new { id = 1 }, listOfPatrons = new[] { new { id = 1 } } }, bill = new { id = 1 } }, p => p.PermissionManageRentingRoom = true ); }
public void Mutation_CreateRate_InvalidRoomKind_InActive() { Database.WriteAsync(realm => realm.Add(new RoomKind { Id = 101, Name = "Tên loại phòng", AmountOfPeople = 1, NumberOfBeds = 1, IsActive = false })).Wait(); SchemaHelper.ExecuteAndExpectError( "Loại phòng có ID: 101 đã ngưng hoại động", @"/_GraphQL/Rate/mutation.createRate.gql", new { input = new { dayRate = 1, nightRate = 1, weekRate = 1, monthRate = 1, lateCheckOutFee = 1, earlyCheckInFee = 1, effectiveStartDate = "0001-01-01T00:00:00+00:00", roomKind = new { id = 101 } } }, p => p.PermissionManageRate = true ); }
public void Mutation_AddBookingToBill_InvalidDate() { SchemaHelper.ExecuteAndExpectError( "Ngày check-in, check-out dự kiến không hợp lệ", @"/_GraphQL/Booking/mutation.addBookingToBill.gql", new { booking = new { bookCheckInTime = DateTimeOffset.Now.AddDays(5), bookCheckOutTime = DateTimeOffset.Now.AddDays(2), room = new { id = 1 }, listOfPatrons = new[] { new { id = 1 } } }, bill = new { id = 1 } }, p => p.PermissionManageRentingRoom = true ); }
public void Mutation_ConfirmCleanedAndServices_InvalidId() { SchemaHelper.ExecuteAndExpectError( "Mã dọn phòng không tồn tại", @"/_GraphQL/HouseKeeping/mutation.confirmCleanedAndServices.gql", new { servicesDetails = new[] { new { number = 1, service = new { id = 1 } }, new { number = 2, service = new { id = 1 } } }, houseKeepingId = 100 }, p => p.PermissionCleaning = true ); }
public void Mutation_DeleteServicesDetail_InvalidBooking_Status() { Database.WriteAsync(realm => { realm.Add(new Booking { Id = 200, Status = (int)Booking.StatusEnum.CheckedOut, EmployeeBooking = EmployeeDataAccess.Get("admin"), EmployeeCheckIn = EmployeeDataAccess.Get("admin"), EmployeeCheckOut = EmployeeDataAccess.Get("admin"), Bill = BillDataAccess.Get(1), Room = RoomDataAccess.Get(1) }); realm.Add(new ServicesDetail { Id = 11, Booking = BookingBusiness.Get(1), Service = ServiceBusiness.Get(200), Number = 10 }); }).Wait(); SchemaHelper.ExecuteAndExpectError( "Phòng đã check-out. Không thể cập nhật/xóa chi tiết dịch vụ", @"/_GraphQL/ServicesDetail/mutation.deleteServicesDetail.gql", new { id = 11 }, p => p.PermissionCleaning = true ); }
public void Mutation_ConfirmCleanedAndServices_InvalidStatus() { Database.WriteAsync(realm => realm.Add(new HouseKeeping { Id = 33, Status = (int)HouseKeeping.StatusEnum.Pending, Type = (int)HouseKeeping.TypeEnum.ExpectedDeparture, Employee = EmployeeBusiness.Get("admin"), Booking = BookingBusiness.Get(1) })).Wait(); SchemaHelper.ExecuteAndExpectError( "Không thể xác nhận dọn phòng", @"/_GraphQL/HouseKeeping/mutation.confirmCleanedAndServices.gql", new { servicesDetails = new[] { new { number = 1, service = new { id = 1 } }, new { number = 2, service = new { id = 1 } } }, houseKeepingId = 33 }, p => p.PermissionCleaning = true ); }
public void Mutation_CreateServicesDetail_InvalidService_InActive() { Database.WriteAsync(realm => realm.Add(new Service { Id = 101, IsActive = false, Name = "Tên dịch vụ", Unit = "Đơn vị" })).Wait(); SchemaHelper.ExecuteAndExpectError( "Dịch vụ 101 đã ngừng cung cấp", @"/_GraphQL/ServicesDetail/mutation.createServicesDetail.gql", new { input = new { number = 1, service = new { id = 101 }, booking = new { id = 1 } } }, p => p.PermissionManageRentingRoom = true ); }
public void Mutation_ConfirmCleanedAndServices_InvalidType() { Database.WriteAsync(realm => realm.Add(new HouseKeeping { Id = 34, Status = (int)HouseKeeping.StatusEnum.Cleaning, Type = (int)HouseKeeping.TypeEnum.ExpectedArrival, Employee = EmployeeBusiness.Get("admin"), Booking = BookingBusiness.Get(1) })).Wait(); SchemaHelper.ExecuteAndExpectError( "Chỉ được sử dụng kiểu xác nhận này đối với phòng check-out", @"/_GraphQL/HouseKeeping/mutation.confirmCleanedAndServices.gql", new { servicesDetails = new[] { new { number = 1, service = new { id = 1 } }, new { number = 2, service = new { id = 1 } } }, houseKeepingId = 34 }, p => p.PermissionCleaning = true ); }
public void Mutation_CreateRoom_InvalidRoomKind_InActive() { Database.WriteAsync(realm => realm.Add(new RoomKind { Id = 103, Name = "Tên loại phòng", AmountOfPeople = 1, NumberOfBeds = 1, IsActive = false })).Wait(); SchemaHelper.ExecuteAndExpectError( "Loại phòng có ID: 103 đã ngưng hoại động", @"/_GraphQL/Room/mutation.createRoom.gql", new { input = new { name = "Phòng 2", roomKind = new { id = 103 }, floor = new { id = 1 } } }, p => p.PermissionManageMap = true ); }
public void Mutation_DeleteService_InvalidId() { SchemaHelper.ExecuteAndExpectError( "Mã dịch vụ không hợp lệ!", @"/_GraphQL/Service/mutation.deleteService.gql", new { id = 100 }, p => p.PermissionManageService = true ); }