public QuestionOverviewPage() { InitializeComponent(); viewModel = new QuestionOverviewViewModel(AppContainer.Resolve <IQuestionRepository>(), AppContainer.Resolve <IAnswerRepository>(), AppContainer.Resolve <IBackendService>()); BindingContext = viewModel; }
public void SetUp() { _questionRepositoryMock = new Mock <IQuestionRepository>(); _teamRepositoryMock = new Mock <IAnswerRepository>(); _backendServiceMock = new Mock <IBackendService>(); _team = GenerateTeam(); _backendServiceMock.Setup(backend => backend.GetTeamByToken(It.IsAny <String>())).ReturnsAsync(_team); _sut = new QuestionOverviewViewModel(_questionRepositoryMock.Object, _teamRepositoryMock.Object, _backendServiceMock.Object); _roundRepositoryMock = new Mock <IRoundRepository>(); _navigationServiceMock = new Mock <INavigationService>(); _sender = new RoundOverviewViewModel(_navigationServiceMock.Object, _roundRepositoryMock.Object); }
public void Constructor_ShouldReceiveRoundAndLoadAllQuestions() { //Arrange var round = GenerateRound(); //Act var sut = new QuestionOverviewViewModel(_questionRepositoryMock.Object, _teamRepositoryMock.Object, _backendServiceMock.Object); _sender.ItemSelectCommand.Execute(round); //Assert Assert.That(sut.Questions, Is.Not.Null); Assert.That(sut.Questions, Is.EqualTo(round.Questions)); }