bleroy / Nwazet.Commerce

Idiomatic commerce module for Orchard CMS.
BSD 3-Clause "New" or "Revised" License
26 stars 21 forks source link

Some tests are failing #109

Closed MatteoPiovanelli-Laser closed 6 years ago

MatteoPiovanelli-Laser commented 7 years ago

Tests failing:

TaskByZipTests.cs: TaxDoesNotApplyToNonMatchingZip() RightTaxAppliesToTabRates() RightTaxAppliesToCsvRates() These tests fail when calling cart.Taxes(), because in ZipCodeTaxPart.cs the GetRates() method does Convert.ToDouble(rateSplit[1]). This has issues related to culture formatting of the string. In the test, that string comes in as ".07": that makes no sense in the it-IT culture, thus the conversion fails and throws an exception.

UspsServiceInternationalTests.cs: InternationalRequestDocumentIsCorrectlyBuilt() fails on Assert.That(package.Element("ValueOfContents").Value, Is.EqualTo("1030.54")); because of culture formatting of that value. In it-IT culture it is "1030,54". InternationalServicePricesReturnsInternationalPrices() fails on the Assert.That(prices, ...). This again has to do with culture formatting, as shipping options in uspsService.prices have prices like 11705 where it should be 117.05. InternationalServicePricesWithCertificateOfMailingYieldsBumpedPrice() InternationalServicePricesWithConfirmationYieldsBumpedPrice() InternationalServicePricesWithExclusionAndValidationExpressionsYieldsTheRightMethods() InternationalServicePricesWithExclusionExpressionExcludesMatchingMethods() InternationalServicePricesWithInsuranceYieldsBumpedPrice() InternationalServicePricesWithRegisteredMailYieldsBumpedPrice() InternationalServicePricesWithReturnReceiptYieldsBumpedPrice() InternationalServicePricesWithSeveralOptionsYieldsCombinedPrice() InternationalServicePricesWithValidationExpressionSelectsMatchingMethods() fails for the same issue on culture formatting of prices.

UspsServiceInternationalTests.cs: Many tests here fail for the same reasons as the ones above.

The failing tests above highlight some issues that the project has in globalization.

ProductAttributeTests.cs: Some tests fail because of the changes made in #91 to the ValidateAttribute method of ProductAttributesPartDriver. Products are added that are not valid. The fix to this is in the next iteration of #103. It's a change on line 70 of the driver, where I should be passing the attributes from the product to the GetAttributes method, rather than those from the dictionary.

MatteoPiovanelli-Laser commented 7 years ago

As some of my other PRs have been pulled, I am sure more tests are now failing. I'll give this my attention in the near future

MatteoPiovanelli-Laser commented 6 years ago

I finally got around to this. A PR will be ready momentarily. As I fixed the test I found a couple places in the module where it was trequired to make small changes to handle culture formatting of strings.