Search in sources :

Example 1 with KSCurrency

use of com.kickstarter.libs.KSCurrency in project android-oss by kickstarter.

the class KSCurrencyTest method testFormatCurrency_withUserInUK.

public void testFormatCurrency_withUserInUK() {
    final KSCurrency currency = createKSCurrency("UK");
    assertEquals("$100 USD", currency.format(100.0f, ProjectFactory.project()));
    assertEquals("$100 CAD", currency.format(100.0f, ProjectFactory.caProject()));
    assertEquals("£100", currency.format(100.0f, ProjectFactory.ukProject()));
}
Also used : KSCurrency(com.kickstarter.libs.KSCurrency)

Example 2 with KSCurrency

use of com.kickstarter.libs.KSCurrency in project android-oss by kickstarter.

the class KSCurrencyTest method testFormatCurrency_withUserInUKAndUSDPreferred.

public void testFormatCurrency_withUserInUKAndUSDPreferred() {
    final KSCurrency currency = createKSCurrency("UK");
    assertEquals("£100", currency.format(100.0f, ProjectFactory.ukProject(), false, true, RoundingMode.DOWN));
}
Also used : KSCurrency(com.kickstarter.libs.KSCurrency)

Example 3 with KSCurrency

use of com.kickstarter.libs.KSCurrency in project android-oss by kickstarter.

the class KSCurrencyTest method testFormatCurrency_withCurrencyCodeExcluded.

public void testFormatCurrency_withCurrencyCodeExcluded() {
    final KSCurrency currency = createKSCurrency("CA");
    assertEquals("$100", currency.format(100.0f, ProjectFactory.project(), true));
}
Also used : KSCurrency(com.kickstarter.libs.KSCurrency)

Example 4 with KSCurrency

use of com.kickstarter.libs.KSCurrency in project android-oss by kickstarter.

the class KSCurrencyTest method testFormatCurrency_roundsDown.

public void testFormatCurrency_roundsDown() {
    final KSCurrency currency = createKSCurrency("US");
    final Project project = ProjectFactory.project();
    assertEquals("$100", currency.format(100.4f, project));
    assertEquals("$100", currency.format(100.5f, project));
    assertEquals("$101", currency.format(101.5f, project));
    assertEquals("$100", currency.format(100.9f, project));
}
Also used : Project(com.kickstarter.models.Project) KSCurrency(com.kickstarter.libs.KSCurrency)

Example 5 with KSCurrency

use of com.kickstarter.libs.KSCurrency in project android-oss by kickstarter.

the class KSCurrencyTest method testFormatCurrency_withUserInUS.

public void testFormatCurrency_withUserInUS() {
    final KSCurrency currency = createKSCurrency("US");
    assertEquals("$100", currency.format(100.0f, ProjectFactory.project()));
    assertEquals("$100 CAD", currency.format(100.0f, ProjectFactory.caProject()));
    assertEquals("£100", currency.format(100.0f, ProjectFactory.ukProject()));
}
Also used : KSCurrency(com.kickstarter.libs.KSCurrency)

Aggregations

KSCurrency (com.kickstarter.libs.KSCurrency)9 Config (com.kickstarter.libs.Config)1 CurrentConfigType (com.kickstarter.libs.CurrentConfigType)1 MockCurrentConfig (com.kickstarter.libs.MockCurrentConfig)1 Project (com.kickstarter.models.Project)1