use of com.kickstarter.ui.adapters.data.ProjectDashboardData in project android-oss by kickstarter.
the class CreatorDashboardViewModelTest method testProjectSwitcherProjectClickOutput.
@Test
public void testProjectSwitcherProjectClickOutput() {
DateTimeUtils.setCurrentMillisFixed(new DateTime().getMillis());
final Project project1 = ProjectFactory.project();
final Project project2 = ProjectFactory.project();
final List<Project> projects = Arrays.asList(project1, project2);
final ProjectStatsEnvelope projectStatsEnvelope = ProjectStatsEnvelopeFactory.projectStatsEnvelope();
final MockApiClient apiClient = new MockApiClient() {
@Override
@NonNull
public Observable<ProjectsEnvelope> fetchProjects(final boolean member) {
return Observable.just(ProjectsEnvelopeFactory.projectsEnvelope(projects));
}
@Override
@NonNull
public Observable<ProjectStatsEnvelope> fetchProjectStats(@NonNull final Project project) {
return Observable.just(projectStatsEnvelope);
}
};
setUpEnvironment(environment().toBuilder().apiClient(apiClient).build());
this.vm.intent(new Intent());
this.vm.inputs.projectSelectionInput(project2);
this.projectDashboardData.assertValues(new ProjectDashboardData(project1, ProjectStatsEnvelopeFactory.projectStatsEnvelope(), false), new ProjectDashboardData(project2, ProjectStatsEnvelopeFactory.projectStatsEnvelope(), false));
}
use of com.kickstarter.ui.adapters.data.ProjectDashboardData in project android-oss by kickstarter.
the class CreatorDashboardViewModelTest method testProjectDashboardData_whenViewingSingleProjects.
public void testProjectDashboardData_whenViewingSingleProjects() {
final Project project = ProjectFactory.project();
final ProjectStatsEnvelope projectStatsEnvelope = ProjectStatsEnvelopeFactory.projectStatsEnvelope();
final MockApiClient apiClient = new MockApiClient() {
@Override
@NonNull
public Observable<ProjectStatsEnvelope> fetchProjectStats(@NonNull final Project project) {
return Observable.just(projectStatsEnvelope);
}
};
setUpEnvironment(environment().toBuilder().apiClient(apiClient).build());
this.vm.intent(new Intent().putExtra(IntentKey.PROJECT, project));
this.projectDashboardData.assertValue(new ProjectDashboardData(project, projectStatsEnvelope, true));
}
use of com.kickstarter.ui.adapters.data.ProjectDashboardData in project android-oss by kickstarter.
the class CreatorDashboardHeaderHolderViewModelTest method testPercentageFunded.
@Test
public void testPercentageFunded() {
setUpEnvironment(environment());
final Project project = ProjectFactory.project();
final ProjectStatsEnvelope projectStatsEnvelope = ProjectStatsEnvelopeFactory.projectStatsEnvelope();
this.vm.inputs.configureWith(new ProjectDashboardData(project, projectStatsEnvelope, false));
final String percentageFundedOutput = NumberUtils.flooredPercentage(project.percentageFunded());
this.percentageFunded.assertValues(percentageFundedOutput);
final int percentageFundedProgressOutput = ProgressBarUtils.progress(project.percentageFunded());
this.percentageFundedProgress.assertValue(percentageFundedProgressOutput);
}
use of com.kickstarter.ui.adapters.data.ProjectDashboardData in project android-oss by kickstarter.
the class CreatorDashboardHeaderHolderViewModelTest method testStartMessagesActivity.
@Test
public void testStartMessagesActivity() {
final User creator = UserFactory.creator();
final CurrentUserType currentUser = new MockCurrentUser(creator);
final Project project = ProjectFactory.project().toBuilder().creator(creator).build();
setUpEnvironment(environment().toBuilder().currentUser(currentUser).build());
this.vm.inputs.configureWith(new ProjectDashboardData(project, ProjectStatsEnvelopeFactory.projectStatsEnvelope(), false));
this.vm.inputs.messagesButtonClicked();
this.startMessageThreadsActivity.assertValue(Pair.create(project, RefTag.dashboard()));
}
use of com.kickstarter.ui.adapters.data.ProjectDashboardData in project android-oss by kickstarter.
the class CreatorDashboardHeaderHolderViewModelTest method testViewProjectButtonIsGone_whenViewingAllProjects.
@Test
public void testViewProjectButtonIsGone_whenViewingAllProjects() {
setUpEnvironment(environment());
this.vm.inputs.configureWith(new ProjectDashboardData(ProjectFactory.project(), ProjectStatsEnvelopeFactory.projectStatsEnvelope(), false));
this.viewProjectButtonIsGone.assertValue(false);
}
Aggregations