use of com.kickstarter.models.Project 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));
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ProjectFactory method backedProject.
@NonNull
public static Project backedProject() {
final Project project = project();
final Reward reward = RewardFactory.reward();
final Backing backing = Backing.builder().amount(10.0f).backerId(IdFactory.id()).id(IdFactory.id()).sequence(1).reward(reward).rewardId(reward.id()).pledgedAt(DateTime.now()).projectCountry(project.country()).projectId(project.id()).shippingAmount(0.0f).status(Backing.STATUS_PLEDGED).build();
return project.toBuilder().backing(backing).isBacking(true).build();
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ProjectIntentMapperTest method testProject_emitsFromKsrProjectUri.
@Test
public void testProject_emitsFromKsrProjectUri() {
final Uri uri = Uri.parse("ksr://www.kickstarter.com/projects/1186238668/skull-graphic-tee");
final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
final TestSubscriber<Project> resultTest = TestSubscriber.create();
ProjectIntentMapper.project(intent, new MockApiClient()).subscribe(resultTest);
resultTest.assertValueCount(1);
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ProjectIntentMapperTest method testProject_emitsFromProjectParamExtra.
@Test
public void testProject_emitsFromProjectParamExtra() {
final Intent intent = new Intent().putExtra(IntentKey.PROJECT_PARAM, "skull-graphic-tee");
final TestSubscriber<Project> resultTest = TestSubscriber.create();
ProjectIntentMapper.project(intent, new MockApiClient()).subscribe(resultTest);
resultTest.assertValueCount(1);
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class CommentsViewModelTest method testCommentsViewModel_showCommentDialog.
@Test
public void testCommentsViewModel_showCommentDialog() {
final CommentsViewModel vm = new CommentsViewModel(environment());
final TestSubscriber<Pair<Project, Boolean>> showCommentDialogTest = new TestSubscriber<>();
vm.outputs.showCommentDialog().subscribe(showCommentDialogTest);
final Project project = ProjectFactory.backedProject();
// Start the view model with a backed project.
vm.intent(new Intent().putExtra(IntentKey.PROJECT, project));
showCommentDialogTest.assertNoValues();
// Click the comment button.
vm.inputs.commentButtonClicked();
// The comment dialog should be shown.
showCommentDialogTest.assertValue(Pair.create(project, true));
}
Aggregations