use of com.kickstarter.models.Backing in project android-oss by kickstarter.
the class ViewPledgeViewModelTest method testShipping_withShippingLocation.
@Test
public void testShipping_withShippingLocation() {
final Location location = LocationFactory.sydney();
final Reward reward = RewardFactory.rewardWithShipping();
final Backing backing = BackingFactory.backing().toBuilder().location(location).reward(reward).rewardId(reward.id()).shippingAmount(5.0f).build();
final ViewPledgeViewModel vm = vm(backing);
final TestSubscriber<String> shippingLocationTextViewTextTest = TestSubscriber.create();
vm.outputs.shippingLocationTextViewText().subscribe(shippingLocationTextViewTextTest);
final TestSubscriber<String> shippingAmountTextViewTextTest = TestSubscriber.create();
vm.outputs.shippingAmountTextViewText().subscribe(shippingAmountTextViewTextTest);
final TestSubscriber<Boolean> shippingSectionIsHiddenTest = TestSubscriber.create();
vm.outputs.shippingSectionIsHidden().subscribe(shippingSectionIsHiddenTest);
vm.intent(intent(backing));
shippingLocationTextViewTextTest.assertValues("Sydney, AU");
shippingAmountTextViewTextTest.assertValues("$5");
shippingSectionIsHiddenTest.assertValues(false);
}
use of com.kickstarter.models.Backing in project android-oss by kickstarter.
the class ViewPledgeViewModelTest method testBackingAmountAndDateTextViewText.
@Test
public void testBackingAmountAndDateTextViewText() {
final Backing backing = BackingFactory.backing().toBuilder().amount(50.0f).build();
final ViewPledgeViewModel vm = vm(backing);
final TestSubscriber<Pair<String, String>> backingAmountAndDateTextViewTextTest = TestSubscriber.create();
vm.outputs.backingAmountAndDateTextViewText().subscribe(backingAmountAndDateTextViewTextTest);
vm.intent(intent(backing));
backingAmountAndDateTextViewTextTest.assertValues(Pair.create("$50", DateTimeUtils.fullDate(backing.pledgedAt())));
}
use of com.kickstarter.models.Backing 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.Backing in project android-oss by kickstarter.
the class ProjectFactory method backedProjectWithRewardLimited.
@NonNull
public static Project backedProjectWithRewardLimited() {
final Project project = project();
final Reward reward = RewardFactory.limited();
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.Backing in project android-oss by kickstarter.
the class MessagesViewModelTest method testConfiguredWithProject_AndBacking.
@Test
public void testConfiguredWithProject_AndBacking() {
final Backing backing = BackingFactory.backing();
final Project project = ProjectFactory.project();
setUpEnvironment(environment().toBuilder().currentUser(new MockCurrentUser(UserFactory.user())).build());
// Start the view model with a backing and a project.
this.vm.intent(backerModalContextIntent(backing, project));
this.backingAndProject.assertValueCount(1);
this.messageList.assertValueCount(1);
}
Aggregations