package com.kickstarter.viewmodels;

import android.content.Intent;

import com.kickstarter.KSRobolectricTestCase;
import com.kickstarter.factories.CategoryFactory;
import com.kickstarter.factories.ProjectFactory;
import com.kickstarter.models.Category;
import com.kickstarter.models.Project;
import com.kickstarter.services.DiscoveryParams;
import com.kickstarter.ui.IntentKey;

import org.junit.Test;

import rx.observers.TestSubscriber;

public final class ThanksViewModelTest extends KSRobolectricTestCase {
  @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());
  }

  @Test
  public void testThanksViewModel_share() {
    final ThanksViewModel vm = new ThanksViewModel(environment());
    final Project project = ProjectFactory.project();

    final TestSubscriber<Project> startShareTest = new TestSubscriber<>();
    vm.outputs.startShare().subscribe(startShareTest);
    final TestSubscriber<Project> startShareOnFacebookTest = new TestSubscriber<>();
    vm.outputs.startShareOnFacebook().subscribe(startShareOnFacebookTest);
    final TestSubscriber<Project> startShareOnTwitterTest = new TestSubscriber<>();
    vm.outputs.startShareOnTwitter().subscribe(startShareOnTwitterTest);

    vm.intent(new Intent().putExtra(IntentKey.PROJECT, ProjectFactory.project()));

    vm.inputs.shareClick();
    startShareTest.assertValues(project);

    vm.inputs.shareOnFacebookClick();
    startShareOnFacebookTest.assertValues(project);

    vm.inputs.shareOnTwitterClick();
    startShareOnTwitterTest.assertValues(project);
  }

  @Test
  public void testThanksViewModel_startDiscovery() {
    final ThanksViewModel vm = new ThanksViewModel(environment());
    final Category category = CategoryFactory.category();

    final TestSubscriber<DiscoveryParams> startDiscoveryTest = new TestSubscriber<>();
    vm.outputs.startDiscovery().subscribe(startDiscoveryTest);

    vm.inputs.categoryClick(null, category);
    startDiscoveryTest.assertValues(DiscoveryParams.builder().category(category).build());
  }

  @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);
  }
}

@@ -60,16 +60,42 @@
 .Intent;
+%0Aimport android.util.Pair;
 %0A%0Aimport
@@ -423,16 +423,40 @@
 .Test;%0A%0A
+import java.util.List;%0A%0A
 import r
@@ -930,24 +930,25 @@
  project));%0A
+%0A
     projectN
@@ -982,32 +982,521 @@
 t.name());%0A  %7D%0A%0A
+  @Test%0A  public void testThanksViewModel_showRecommendations() %7B%0A    final ThanksViewModel vm = new ThanksViewModel(environment());%0A    final Project project = ProjectFactory.project();%0A%0A    final TestSubscriber%3CPair%3CList%3CProject%3E, Category%3E%3E showRecommendationsTest = new TestSubscriber%3C%3E();%0A    vm.outputs.showRecommendations().subscribe(showRecommendationsTest);%0A%0A    vm.intent(new Intent().putExtra(IntentKey.PROJECT, project));%0A%0A    showRecommendationsTest.assertValueCount(1);%0A  %7D%0A%0A
   @Test%0A  public

Add basic show recommendations test