public void GetById_ValidId_Tester() { var eventTest = _eventTestRepository.GetbyId(196417); Assert.IsNotNull(eventTest); Assert.AreEqual(eventTest.EventId, 24762); Assert.AreEqual(eventTest.Id, 196417); Assert.AreEqual(eventTest.TestId, 2); }
public OrderViewData Create(OrderDetail orderDetail) { var orderDetailOrganizationRoleUserCreator = GetOrganizationRoleUser(orderDetail, od => od.DataRecorderMetaData.DataRecorderCreator.Id); var orderDetailOrganizationRoleUserFor = GetOrganizationRoleUser(orderDetail, od => od.ForOrganizationRoleUserId); var description = orderDetail.Description; if (orderDetail.DetailType == OrderItemType.EventPackageItem) { var package = _eventPackageRepository.GetById(orderDetail.OrderItem.ItemId); description = package == null ? "" : package.Package.Name; } else if (orderDetail.DetailType == OrderItemType.EventTestItem) { var eventTest = _eventTestRepository.GetbyId(orderDetail.OrderItem.ItemId); description = eventTest == null ? "" : eventTest.Test.Name; } else if (orderDetail.DetailType == OrderItemType.ProductItem) { description = _electronicProductRepository.GetElectronicProductNameForOrder(orderDetail.OrderItemId); } var customer = _customerRepository.GetCustomerByUserId(orderDetailOrganizationRoleUserFor.FirstValue.UserId); //var creatorRoleName = // ((Roles)orderDetailOrganizationRoleUserCreator.FirstValue.RoleId).ToString(); var orderDetailDateCreated = orderDetail.DataRecorderMetaData != null ? orderDetail.DataRecorderMetaData.DateCreated.ToString("MMM dd yyyy") : null; var eventCustomerId = (orderDetail.DetailType == OrderItemType.EventPackageItem || orderDetail.DetailType == OrderItemType.EventTestItem) && orderDetail.EventCustomerOrderDetail != null ? orderDetail.EventCustomerOrderDetail.EventCustomerId : 0; var orderViewData = new OrderViewData { CreationMode = orderDetailOrganizationRoleUserCreator.SecondValue.SecondValue, CreatorName = orderDetailOrganizationRoleUserCreator.SecondValue.FirstValue, CreatorRole = orderDetailOrganizationRoleUserCreator.SecondValue.SecondValue, CustomerId = customer.CustomerId, CustomerName = customer.NameAsString, Description = description, EventCustomerId = eventCustomerId, OrderDetailDateCreated = orderDetailDateCreated, OrderDetailStatus = orderDetail.OrderItemStatus.Name, OrderDetailType = orderDetail.OrderItemStatus.ItemTypeName, Price = orderDetail.Price, Quantity = orderDetail.Quantity, ShippingDetails = GetShippingDetailUserPair(orderDetail.Id).ToList() }; if ((orderDetail.DetailType == OrderItemType.EventPackageItem || orderDetail.DetailType == OrderItemType.EventTestItem) && orderDetail.SourceCodeOrderDetail != null) { orderViewData.SourceCode = GetSourceCodeUserPair(orderDetail.SourceCodeOrderDetail); } return(orderViewData); }