public void AddAstronautInSpace()
        {
            InMemoryAstronautRepository repository = new InMemoryAstronautRepository();
            Astronaut astronaut = new Astronaut("Buzz Aldrin", "Apollo 11");

            repository.Add(astronaut);

            Assert.AreEqual(astronaut, repository.GetAstronautsInSpace()[0]);
        }
        public void RemoveAstronautInSpace()
        {
            InMemoryAstronautRepository repository = new InMemoryAstronautRepository();
            Astronaut astronaut = new Astronaut("Buzz Aldrin", "Apollo 11");

            repository.Add(astronaut);

            repository.Remove(astronaut);

            Assert.AreEqual(0, repository.GetAstronautsInSpace().Count);
        }
        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);
        }
Exemple #4
0
        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);
        }
        public void GetAstronautsInSpace()
        {
            InMemoryAstronautRepository repository = new InMemoryAstronautRepository();

            Assert.AreEqual(0, repository.GetAstronautsInSpace().Count);
        }