コード例 #1
0
        public async Task CanExportCustomersToXlsx()
        {
            var customers = await _customerService.GetAllCustomersAsync();

            var excelData = await _exportManager.ExportCustomersToXlsxAsync(customers);

            var worksheet = GetWorksheets(excelData);
            var manager   = GetPropertyManager <Customer>(worksheet);

            manager.ReadFromXlsx(worksheet, 2);
            var customer = customers.First();

            var ignore = new List <string> {
                "Id", "ExternalAuthenticationRecords", "CustomerRoles", "ShoppingCartItems",
                "ReturnRequests", "BillingAddress", "ShippingAddress", "Addresses", "AdminComment",
                "EmailToRevalidate", "HasShoppingCartItems", "RequireReLogin", "FailedLoginAttempts",
                "CannotLoginUntilDateUtc", "Deleted", "IsSystemAccount", "SystemName", "LastIpAddress",
                "LastLoginDateUtc", "LastActivityDateUtc", "RegisteredInStoreId", "BillingAddressId", "ShippingAddressId",
                "CustomerCustomerRoleMappings", "CustomerAddressMappings", "EntityCacheKey", "VendorId"
            };

            AreAllObjectPropertiesPresent(customer, manager, ignore.ToArray());
            PropertiesShouldEqual(customer, manager, new Dictionary <string, string>());
        }