use of uk.ivanc.archimvvm.model.Repository in project archi by ivacf.
the class MainViewModelTest method shouldSearchUsernameWithRepos.
@Test
public void shouldSearchUsernameWithRepos() {
String username = "usernameWithRepos";
TextView textView = new TextView(application);
textView.setText(username);
List<Repository> mockRepos = MockModelFabric.newListOfRepositories(10);
doReturn(rx.Observable.just(mockRepos)).when(githubService).publicRepositories(username);
mainViewModel.onSearchAction(textView, EditorInfo.IME_ACTION_SEARCH, null);
verify(dataListener).onRepositoriesChanged(mockRepos);
assertEquals(mainViewModel.infoMessageVisibility.get(), View.INVISIBLE);
assertEquals(mainViewModel.progressVisibility.get(), View.INVISIBLE);
assertEquals(mainViewModel.recyclerViewVisibility.get(), View.VISIBLE);
}
use of uk.ivanc.archimvvm.model.Repository in project archi by ivacf.
the class ItemRepoViewModelTest method shouldGetDescription.
@Test
public void shouldGetDescription() {
Repository repository = new Repository();
repository.description = "This is the description";
ItemRepoViewModel itemRepoViewModel = new ItemRepoViewModel(application, repository);
assertEquals(repository.description, itemRepoViewModel.getDescription());
}
use of uk.ivanc.archimvvm.model.Repository in project archi by ivacf.
the class ItemRepoViewModelTest method shouldGetForks.
@Test
public void shouldGetForks() {
Repository repository = new Repository();
repository.forks = 5;
String expectedString = application.getString(R.string.text_forks, repository.forks);
ItemRepoViewModel itemRepoViewModel = new ItemRepoViewModel(application, repository);
assertEquals(expectedString, itemRepoViewModel.getForks());
}
Aggregations