Search in sources :

Example 21 with Backing

use of com.kickstarter.models.Backing in project android-oss by kickstarter.

the class ViewPledgeViewModelTest method testBackerNameTextViewText.

@Test
public void testBackerNameTextViewText() {
    final Backing backing = BackingFactory.backing();
    final ViewPledgeViewModel vm = vm(backing);
    final TestSubscriber<String> backerNameTextViewTextTest = TestSubscriber.create();
    vm.outputs.backerNameTextViewText().subscribe(backerNameTextViewTextTest);
    vm.intent(intent(backing));
    backerNameTextViewTextTest.assertValues(backing.backer().name());
}
Also used : Backing(com.kickstarter.models.Backing) Test(org.junit.Test)

Example 22 with Backing

use of com.kickstarter.models.Backing in project android-oss by kickstarter.

the class ViewPledgeViewModelTest method testRewardMinimumAndDescriptionTextViewText.

@Test
public void testRewardMinimumAndDescriptionTextViewText() {
    final Reward reward = RewardFactory.reward().toBuilder().minimum(100.0f).build();
    final Backing backing = BackingFactory.backing().toBuilder().reward(reward).build();
    final ViewPledgeViewModel vm = vm(backing);
    final TestSubscriber<Pair<String, String>> rewardMinimumAndDescriptionTextViewTextTest = TestSubscriber.create();
    vm.outputs.rewardMinimumAndDescriptionTextViewText().subscribe(rewardMinimumAndDescriptionTextViewTextTest);
    vm.intent(intent(backing));
    rewardMinimumAndDescriptionTextViewTextTest.assertValues(Pair.create("$100", backing.reward().description()));
}
Also used : Reward(com.kickstarter.models.Reward) Backing(com.kickstarter.models.Backing) Pair(android.util.Pair) Test(org.junit.Test)

Example 23 with Backing

use of com.kickstarter.models.Backing in project android-oss by kickstarter.

the class ViewPledgeViewModelTest method testLoadBackerAvatar.

@Test
public void testLoadBackerAvatar() {
    final Backing backing = BackingFactory.backing();
    final ViewPledgeViewModel vm = vm(backing);
    final TestSubscriber<String> loadBackerAvatarTest = TestSubscriber.create();
    vm.outputs.loadBackerAvatar().subscribe(loadBackerAvatarTest);
    vm.intent(intent(backing));
    loadBackerAvatarTest.assertValues(backing.backer().avatar().medium());
}
Also used : Backing(com.kickstarter.models.Backing) Test(org.junit.Test)

Example 24 with Backing

use of com.kickstarter.models.Backing in project android-oss by kickstarter.

the class ViewPledgeViewModelTest method testGoBackOnProjectClick.

@Test
public void testGoBackOnProjectClick() {
    final Backing backing = BackingFactory.backing();
    final ViewPledgeViewModel vm = vm(backing);
    final TestSubscriber<Void> goBackTest = TestSubscriber.create();
    vm.outputs.goBack().subscribe(goBackTest);
    vm.intent(intent(backing));
    goBackTest.assertNoValues();
    vm.inputs.projectClicked();
    goBackTest.assertValueCount(1);
}
Also used : Backing(com.kickstarter.models.Backing) Test(org.junit.Test)

Example 25 with Backing

use of com.kickstarter.models.Backing in project android-oss by kickstarter.

the class ViewPledgeViewModelTest method testBackerNumberTextViewText.

@Test
public void testBackerNumberTextViewText() {
    final Backing backing = BackingFactory.backing();
    final ViewPledgeViewModel vm = vm(backing);
    final TestSubscriber<String> backerNumberTextViewTextTest = TestSubscriber.create();
    vm.outputs.backerNumberTextViewText().subscribe(backerNumberTextViewTextTest);
    vm.intent(intent(backing));
    backerNumberTextViewTextTest.assertValues(NumberUtils.format(backing.sequence()));
}
Also used : Backing(com.kickstarter.models.Backing) Test(org.junit.Test)

Aggregations

Backing (com.kickstarter.models.Backing)30 Test (org.junit.Test)26 MockCurrentUser (com.kickstarter.libs.MockCurrentUser)11 Project (com.kickstarter.models.Project)11 NonNull (androidx.annotation.NonNull)9 MockApiClient (com.kickstarter.mock.services.MockApiClient)9 MessageThreadEnvelope (com.kickstarter.services.apiresponses.MessageThreadEnvelope)8 Reward (com.kickstarter.models.Reward)7 User (com.kickstarter.models.User)6 BackingWrapper (com.kickstarter.models.BackingWrapper)4 MessageThread (com.kickstarter.models.MessageThread)4 NonNull (android.support.annotation.NonNull)3 Pair (android.util.Pair)2 Collections.emptyList (java.util.Collections.emptyList)2 List (java.util.List)2 Location (com.kickstarter.models.Location)1