public void GetConferences_Should_Return_NonEmpty_List() { var httpClient = new HttpClient(); var cs = new ConferencesService(httpClient); var result = cs.GetConferences().Result; //Assert. ... }
public MainPage() { InitializeComponent(); var apiService = new ApiService(TekConfApiUrl); var service = new ConferencesService(apiService); _viewModel = new MainViewModel(service); this.BindingContext = _viewModel; _viewModel.GetConferences(); }
public async Task GetConference(string slug) { var fixture = new Fixture(); var tekconfApi = new Mock <ITekConfApi>(); var expectedName = fixture.Create <string>(); var expectedConference = new ConferenceDto { Slug = slug, Name = expectedName }; tekconfApi.Setup(x => x.GetConference(slug)).ReturnsAsync(expectedConference); var api = new Mock <IApiService>(); var service = new ConferencesService(api.Object); var conference = await service.GetConference(Priority.UserInitiated, slug); conference.ShouldNotBeNull(); conference.Name.ShouldEqual(expectedName); tekconfApi.Verify(x => x.GetConference(slug), Times.Exactly(1)); }
public async Task GetConferences() { var fixture = new Fixture(); var tekconfApi = new Mock <ITekConfApi>(); var expectedConferences = new List <ConferenceDto> { fixture.Create <ConferenceDto>() }; tekconfApi.Setup(x => x.GetConferences()).ReturnsAsync(expectedConferences); var apiService = new Mock <IApiService>(); var service = new ConferencesService(apiService.Object); var conferences = await service.GetConferences(Priority.UserInitiated); conferences.ShouldNotBeNull(); conferences.Count().ShouldEqual(1); tekconfApi.Verify(x => x.GetConferences(), Times.Exactly(1)); }