use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ThanksViewModelTest method testThanksViewModel_projectName.
@Test
public void testThanksViewModel_projectName() {
final ThanksViewModel vm = new ThanksViewModel(environment());
final Project project = ProjectFactory.project();
final TestSubscriber<String> projectNameTest = new TestSubscriber<>();
vm.outputs.projectName().subscribe(projectNameTest);
vm.intent(new Intent().putExtra(IntentKey.PROJECT, project));
projectNameTest.assertValues(project.name());
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ThanksViewModelTest method testThanksViewModel_dontShowGamesNewsletterDialogIfRootCategoryIsNotGames.
@Test
public void testThanksViewModel_dontShowGamesNewsletterDialogIfRootCategoryIsNotGames() {
final MockBooleanPreference hasSeenGamesNewsletterPreference = new MockBooleanPreference(false);
final User user = UserFactory.user().toBuilder().gamesNewsletter(false).build();
final CurrentUserType currentUser = new MockCurrentUser(user);
final Environment environment = environment().toBuilder().currentUser(currentUser).hasSeenGamesNewsletterPreference(hasSeenGamesNewsletterPreference).build();
final ThanksViewModel vm = new ThanksViewModel(environment);
final TestSubscriber<Void> showGamesNewsletterDialogTest = new TestSubscriber<>();
vm.outputs.showGamesNewsletterDialog().subscribe(showGamesNewsletterDialogTest);
final Project project = ProjectFactory.project().toBuilder().category(CategoryFactory.ceramicsCategory()).build();
vm.intent(new Intent().putExtra(IntentKey.PROJECT, project));
showGamesNewsletterDialogTest.assertValueCount(0);
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ThanksViewModelTest method testThanksViewModel_showRecommendations.
@Test
public void testThanksViewModel_showRecommendations() {
final ThanksViewModel vm = new ThanksViewModel(environment());
final Project project = ProjectFactory.project();
final TestSubscriber<Pair<List<Project>, Category>> showRecommendationsTest = new TestSubscriber<>();
vm.outputs.showRecommendations().subscribe(showRecommendationsTest);
vm.intent(new Intent().putExtra(IntentKey.PROJECT, project));
showRecommendationsTest.assertValueCount(1);
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ThanksViewModelTest method testThanksViewModel_startProject.
@Test
public void testThanksViewModel_startProject() {
final ThanksViewModel vm = new ThanksViewModel(environment());
final Project project = ProjectFactory.project();
final TestSubscriber<Project> startProjectTest = new TestSubscriber<>();
vm.outputs.startProject().subscribe(startProjectTest);
vm.inputs.projectClick(null, project);
startProjectTest.assertValues(project);
koalaTest.assertValue("Checkout Finished Discover Open Project");
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ThanksViewModelTest method testThanksViewModel_dontShowRatingDialogIfGamesNewsletterWillDisplay.
@Test
public void testThanksViewModel_dontShowRatingDialogIfGamesNewsletterWillDisplay() {
final MockBooleanPreference hasSeenAppRatingPreference = new MockBooleanPreference(false);
final MockBooleanPreference hasSeenGamesNewsletterPreference = new MockBooleanPreference(false);
final User user = UserFactory.user().toBuilder().gamesNewsletter(false).build();
final CurrentUserType currentUser = new MockCurrentUser(user);
final Environment environment = environment().toBuilder().currentUser(currentUser).hasSeenAppRatingPreference(hasSeenAppRatingPreference).hasSeenGamesNewsletterPreference(hasSeenGamesNewsletterPreference).build();
final ThanksViewModel vm = new ThanksViewModel(environment);
final TestSubscriber<Void> showRatingDialogTest = new TestSubscriber<>();
vm.outputs.showRatingDialog().subscribe(showRatingDialogTest);
final Project project = ProjectFactory.project().toBuilder().category(CategoryFactory.tabletopGamesCategory()).build();
vm.intent(new Intent().putExtra(IntentKey.PROJECT, project));
showRatingDialogTest.assertValueCount(0);
}
Aggregations