public void CanDeleteCustomerReservationsHelper() { var product = _productRepository.Insert(new Product { Name = "CanDeleteCustomerReservationsHelper", ProductType = ProductType.Reservation }); var toInsert1 = new CustomerReservationsHelper { ShoppingCartItemId = "CanDeleteCustomerReservationsHelper1" }; var toInsert2 = new CustomerReservationsHelper { ShoppingCartItemId = "CanDeleteCustomerReservationsHelper2" }; _productReservationService.InsertCustomerReservationsHelper(toInsert1); _productReservationService.InsertCustomerReservationsHelper(toInsert2); var before = _productReservationService.GetCustomerReservationsHelperBySciId("CanDeleteCustomerReservationsHelper1"); _productReservationService.DeleteCustomerReservationsHelper(before.First()); var after = _productReservationService.GetCustomerReservationsHelperBySciId("CanDeleteCustomerReservationsHelper1"); Assert.AreEqual(0, after.Count); }
/// <summary> /// Deletes customer reservations helper /// </summary> /// <param name="crh"></param> public void DeleteCustomerReservationsHelper(CustomerReservationsHelper crh) { if (crh == null) { throw new ArgumentNullException("CustomerReservationsHelper"); } _customerReservationsHelperRepository.Delete(crh); _eventPublisher.EntityDeleted(crh); }
/// <summary> /// Adds customer reservations helper /// </summary> /// <param name="crh"></param> public virtual void InsertCustomerReservationsHelper(CustomerReservationsHelper crh) { if (crh == null) { throw new ArgumentNullException("CustomerReservationsHelper"); } _customerReservationsHelperRepository.Insert(crh); _eventPublisher.EntityInserted(crh); }
/// <summary> /// Deletes customer reservations helper /// </summary> /// <param name="crh"></param> public virtual async Task DeleteCustomerReservationsHelper(CustomerReservationsHelper crh) { if (crh == null) { throw new ArgumentNullException("CustomerReservationsHelper"); } await _customerReservationsHelperRepository.DeleteAsync(crh); await _mediator.EntityDeleted(crh); }
/// <summary> /// Adds customer reservations helper /// </summary> /// <param name="crh"></param> public virtual async Task InsertCustomerReservationsHelper(CustomerReservationsHelper crh) { if (crh == null) { throw new ArgumentNullException("CustomerReservationsHelper"); } await _customerReservationsHelperRepository.UpdateAsync(crh); await _eventPublisher.EntityInserted(crh); }
/// <summary> /// Adds customer reservations helper /// </summary> /// <param name="crh"></param> public virtual async Task InsertCustomerReservationsHelper(CustomerReservationsHelper crh) { if (crh == null) { throw new ArgumentNullException(nameof(crh)); } await _customerReservationsHelperRepository.InsertAsync(crh); //event await _mediator.EntityInserted(crh); }
public void CanGetCustomerReservationsHelperBySciId() { var toInsert = new CustomerReservationsHelper { CustomerId = "CanGetCustomerReservationsHelperBySciIdC", ReservationId = "CanGetCustomerReservationsHelperBySciIdR", ShoppingCartItemId = "CanGetCustomerReservationsHelperBySciIdS" }; _productReservationService.InsertCustomerReservationsHelper(toInsert); var found = _productReservationService.GetCustomerReservationsHelperBySciId("CanGetCustomerReservationsHelperBySciIdS"); Assert.AreEqual(1, found.Count); Assert.AreNotEqual(0, found.Where(x => x.ShoppingCartItemId == "CanGetCustomerReservationsHelperBySciIdS").Count()); }
public void CanGetCustomerReservationsHelperById() { var toInsert = new CustomerReservationsHelper { CustomerId = "CanGetCustomerReservationsHelperById", ReservationId = "CanGetCustomerReservationsHelperById", ShoppingCartItemId = "CanGetCustomerReservationsHelperById" }; _productReservationService.InsertCustomerReservationsHelper(toInsert); var inserted = _customerReservationsHelperRepository.Table. Where(x => x.CustomerId == "CanGetCustomerReservationsHelperById").FirstOrDefault(); var found = _productReservationService.GetCustomerReservationsHelperById(inserted.Id); Assert.AreEqual(inserted.ShoppingCartItemId, found.ShoppingCartItemId); }
public void CanAddCustomerReservationHelper() { var toInsert = new CustomerReservationsHelper { CustomerId = "CanAddCustomerReservationHelperC", ReservationId = "CanAddCustomerReservationHelperR", ShoppingCartItemId = "CanAddCustomerReservationHelperS" }; _productReservationService.InsertCustomerReservationsHelper(toInsert); var inserted = _customerReservationsHelperRepository.Table. Where(x => x.CustomerId == "CanAddCustomerReservationHelperC").FirstOrDefault(); Assert.AreNotEqual(null, inserted); Assert.AreNotEqual(null, inserted.Id); Assert.AreEqual("CanAddCustomerReservationHelperC", inserted.CustomerId); Assert.AreEqual("CanAddCustomerReservationHelperR", inserted.ReservationId); Assert.AreEqual("CanAddCustomerReservationHelperS", inserted.ShoppingCartItemId); }