Exemplo n.º 1
0
 public ProposalController(ConferenceApiService conferenceService, ProposalApiService proposalService,
                           IAuthorizationService authorizationService)
 {
     this.conferenceService    = conferenceService;
     this.proposalService      = proposalService;
     this.authorizationService = authorizationService;
 }
        public async Task WhenErrorFindingSpeaker_ReturnsConferenceApiException(int errorCode, StringContent response, HttpStatusCode statusCode)
        {
            ConferenceApiService sut = Initialiser.BuildService(response, statusCode);

            var result = await Assert.ThrowsAsync <ConferenceApiException>(() => sut.FindSpeaker("Random Speaker"));

            Assert.Equal(errorCode, (int)result.StatusCode);
        }
Exemplo n.º 3
0
        public static ConferenceApiService BuildService(StringContent response, HttpStatusCode statusCode)
        {
            var opts          = Initialiser.ConferenceApiConfig();
            var clientFactory = Initialiser.ConferenceClientFactory(response,
                                                                    statusCode);
            var sut = new ConferenceApiService(opts, clientFactory);

            return(sut);
        }
        public async Task WhenSpeakerNotFound_ReturnsNull()
        {
            const string NAME_TO_SEARCH           = "Scott Guthriex";
            var          opts                     = Initialiser.ConferenceApiConfig();
            var          clientFactoryForSpeakers = Initialiser.ConferenceClientFactory(ConferenceApiResponses.SpeakersResponse);
            var          sut = new ConferenceApiService(opts, clientFactoryForSpeakers);

            var result = await sut.FindSpeaker(NAME_TO_SEARCH);

            //, new DateTime(2013,12,04,11,10,00)

            Assert.Null(result);
        }
        public async Task WhenSpeakerFound_ReturnsSpeaker()
        {
            const string NAME_TO_SEARCH           = "Scott Guthrie";
            var          opts                     = Initialiser.ConferenceApiConfig();
            var          clientFactoryForSpeakers = Initialiser.ConferenceClientFactory(ConferenceApiResponses.SpeakersResponse);
            var          sut = new ConferenceApiService(opts, clientFactoryForSpeakers);

            var result = await sut.FindSpeaker(NAME_TO_SEARCH);

            //, new DateTime(2013,12,04,11,10,00)

            Assert.IsType <Item>(result);
            Assert.Equal(NAME_TO_SEARCH, result.data[0].value);
        }
 public ProposalController(ConferenceApiService conferenceService, ProposalApiService proposalService)
 {
     this.conferenceService = conferenceService;
     this.proposalService   = proposalService;
 }
 public ConferenceController(ConferenceApiService service)
 {
     this.service = service;
 }