use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ProjectViewModelTest method testProjectViewModel_StartProjectUpdatesActivity.
@Test
public void testProjectViewModel_StartProjectUpdatesActivity() {
final ProjectViewModel.ViewModel vm = new ProjectViewModel.ViewModel(environment());
final Project project = ProjectFactory.project();
final TestSubscriber<Project> startProjectUpdatesActivity = new TestSubscriber<>();
vm.outputs.startProjectUpdatesActivity().subscribe(startProjectUpdatesActivity);
// Start the view model with a project.
vm.intent(new Intent().putExtra(IntentKey.PROJECT, project));
// Click on Updates button.
vm.inputs.updatesTextViewClicked();
startProjectUpdatesActivity.assertValues(project);
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ProjectViewModelTest method testProjectViewModel_StartVideoActivity.
@Test
public void testProjectViewModel_StartVideoActivity() {
final ProjectViewModel.ViewModel vm = new ProjectViewModel.ViewModel(environment());
final Project project = ProjectFactory.project();
final TestSubscriber<Project> startVideoActivity = new TestSubscriber<>();
vm.outputs.startVideoActivity().subscribe(startVideoActivity);
// Start the view model with a project.
vm.intent(new Intent().putExtra(IntentKey.PROJECT, project));
vm.inputs.playVideoButtonClicked();
startVideoActivity.assertValues(project);
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ProjectViewModelTest method testProjectViewModel_StartCreatorBioWebViewActivity.
@Test
public void testProjectViewModel_StartCreatorBioWebViewActivity() {
final ProjectViewModel.ViewModel vm = new ProjectViewModel.ViewModel(environment());
final Project project = ProjectFactory.project();
final TestSubscriber<Project> startCreatorBioWebViewActivity = new TestSubscriber<>();
vm.outputs.startCreatorBioWebViewActivity().subscribe(startCreatorBioWebViewActivity);
// Start the view model with a project.
vm.intent(new Intent().putExtra(IntentKey.PROJECT, project));
vm.inputs.creatorNameTextViewClicked();
startCreatorBioWebViewActivity.assertValues(project);
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ProjectViewModelTest method testProjectViewModel_StartCampaignWebViewActivity.
@Test
public void testProjectViewModel_StartCampaignWebViewActivity() {
final ProjectViewModel.ViewModel vm = new ProjectViewModel.ViewModel(environment());
final Project project = ProjectFactory.project();
final TestSubscriber<Project> startCampaignWebViewActivity = new TestSubscriber<>();
vm.outputs.startCampaignWebViewActivity().subscribe(startCampaignWebViewActivity);
// Start the view model with a project.
vm.intent(new Intent().putExtra(IntentKey.PROJECT, project));
vm.inputs.blurbTextViewClicked();
startCampaignWebViewActivity.assertValues(project);
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class RewardViewModelTest method testGoToCheckoutWhenProjectIsLive.
@Test
public void testGoToCheckoutWhenProjectIsLive() {
final RewardViewModel vm = new RewardViewModel(environment());
final Reward reward = RewardFactory.reward();
final TestSubscriber<Pair<Project, Reward>> startCheckoutTest = TestSubscriber.create();
vm.outputs.goToCheckout().subscribe(startCheckoutTest);
final Project liveProject = ProjectFactory.project();
vm.inputs.projectAndReward(liveProject, reward);
startCheckoutTest.assertNoValues();
// When a reward from a live project is clicked, start checkout.
vm.inputs.rewardClicked();
startCheckoutTest.assertValue(Pair.create(liveProject, reward));
}
Aggregations