public async Task CanExportOrdersXlsx() { var orders = await _orderService.SearchOrdersAsync(); var excelData = await _exportManager.ExportOrdersToXlsxAsync(orders); var worksheet = GetWorksheets(excelData); var manager = GetPropertyManager <Order>(worksheet); manager.ReadFromXlsx(worksheet, 2); var replacePairs = new Dictionary <string, string> { { "OrderId", "Id" }, { "OrderStatus", "OrderStatusId" }, { "PaymentStatus", "PaymentStatusId" }, { "ShippingStatus", "ShippingStatusId" }, { "ShippingPickupInStore", "PickupInStore" } }; var order = orders.First(); var ignore = new List <string>(); ignore.AddRange(replacePairs.Values); //not exported fields ignore.AddRange(new[] { "BillingAddressId", "ShippingAddressId", "PickupAddressId", "CustomerTaxDisplayTypeId", "RewardPointsHistoryEntryId", "CheckoutAttributeDescription", "CheckoutAttributesXml", "CustomerLanguageId", "CustomerIp", "AllowStoringCreditCardNumber", "CardType", "CardName", "CardNumber", "MaskedCreditCardNumber", "CardCvv2", "CardExpirationMonth", "CardExpirationYear", "AuthorizationTransactionId", "AuthorizationTransactionCode", "AuthorizationTransactionResult", "CaptureTransactionId", "CaptureTransactionResult", "SubscriptionTransactionId", "PaidDateUtc", "Deleted", "PickupAddress", "RedeemedRewardPointsEntryId", "DiscountUsageHistory", "GiftCardUsageHistory", "OrderNotes", "OrderItems", "Shipments", "OrderStatus", "PaymentStatus", "ShippingStatus", "CustomerTaxDisplayType", "CustomOrderNumber" }); //fields tested individually ignore.AddRange(new[] { "Customer", "BillingAddressId", "ShippingAddressId", "EntityCacheKey" }); manager.SetSelectList("OrderStatus", await OrderStatus.Pending.ToSelectListAsync(useLocalization: false)); manager.SetSelectList("PaymentStatus", await PaymentStatus.Pending.ToSelectListAsync(useLocalization: false)); manager.SetSelectList("ShippingStatus", await ShippingStatus.ShippingNotRequired.ToSelectListAsync(useLocalization: false)); AreAllObjectPropertiesPresent(order, manager, ignore.ToArray()); PropertiesShouldEqual(order, manager, replacePairs); var addressFields = new List <string> { "FirstName", "LastName", "Email", "Company", "Country", "StateProvince", "City", "County", "Address1", "Address2", "ZipPostalCode", "PhoneNumber", "FaxNumber" }; const string billingPattern = "Billing"; replacePairs = addressFields.ToDictionary(p => billingPattern + p, p => p); var testBillingAddress = await _addressService.GetAddressByIdAsync(order.BillingAddressId); PropertiesShouldEqual(testBillingAddress, manager, replacePairs, "CreatedOnUtc", "BillingCountry"); var country = await _countryService.GetCountryByAddressAsync(testBillingAddress); manager.GetProperties.First(p => p.PropertyName == "BillingCountry").PropertyValue.Should().Be(country.Name); const string shippingPattern = "Shipping"; replacePairs = addressFields.ToDictionary(p => shippingPattern + p, p => p); var testShippingAddress = await _addressService.GetAddressByIdAsync(order.ShippingAddressId ?? 0); PropertiesShouldEqual(testShippingAddress, manager, replacePairs, "CreatedOnUtc", "ShippingCountry"); country = await _countryService.GetCountryByAddressAsync(testShippingAddress); manager.GetProperties.First(p => p.PropertyName == "ShippingCountry").PropertyValue.Should().Be(country.Name); }