public AstronautsViewController(AstronautsViewModel viewModel) { _viewModel = viewModel; _viewModel.SetView(this); TableView.RegisterClassForCellReuse(typeof(UITableViewCell), "cell"); }
public async Task CanFetchAstronauts() { var repository = new InMemoryAstronautRepository(); repository.Add(new Astronaut("Buzz Aldrin", "Apollo 11")); var view = new DummyView(); var viewModel = new AstronautsViewModel(repository); viewModel.SetView(view); await viewModel.FetchAstronauts(); Assert.AreEqual(1, view.Astronauts.Count); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { _repository = new InMemoryAstronautRepository(); _repository.Add(new Astronaut("Oleg Novitskiy", "ISS")); _repository.Add(new Astronaut("Thomas Pesquet", "ISS")); _repository.Add(new Astronaut("Peggy Whitson", "ISS")); var astronautsViewModel = new AstronautsViewModel(_repository); var astronautsViewController = new AstronautsViewController(astronautsViewModel); var window = new UIWindow(UIScreen.MainScreen.Bounds); window.RootViewController = new UINavigationController(astronautsViewController); window.MakeKeyAndVisible(); Window = window; return(true); }