public void BeforeScenario()
        {
            var config = _objectContainer.Resolve <LocalConfiguration>();

            AccountsApiMessageHandler accountsApiMessageHandlers = new AccountsApiMessageHandler(config.AccountsApiBaseUrl);

            AccountsApi = new AccountsApi(accountsApiMessageHandlers);

            ProviderEventsApiMessageHandler providerApiMessageHandlers = new ProviderEventsApiMessageHandler(config.PaymentsApiBaseUrl);

            ProviderEventsApi = new ProviderEventsApi(providerApiMessageHandlers);

            CommitmentsApiMessageHandler commitmentsApiMessageHandlers = new CommitmentsApiMessageHandler(config.CommitmentsApiBaseUrl);

            CommitmentsApi = new CommitmentsApi(commitmentsApiMessageHandlers);

            EventsApiMessageHandler eventsApiMessageHandlers = new EventsApiMessageHandler(config.EventsApiBaseUrl);

            EventsApiSubstitute = new EventsApi(eventsApiMessageHandlers);

            TokenServiceApiMessageHandler tokenApiMessageHandlers = new TokenServiceApiMessageHandler(config.TokenServiceApiBaseUrl);

            TokenApiSubstitute = new TokenServiceApi(tokenApiMessageHandlers);

            HmrcApiMessageHandler hmrcApiMessageHandlers = new HmrcApiMessageHandler(config.HmrcApiBaseUrl);

            HmrcApi = new HmrcApi(hmrcApiMessageHandlers);

            _objectContainer.RegisterInstanceAs(accountsApiMessageHandlers);
            _objectContainer.RegisterInstanceAs(providerApiMessageHandlers);
            _objectContainer.RegisterInstanceAs(commitmentsApiMessageHandlers);
            _objectContainer.RegisterInstanceAs(hmrcApiMessageHandlers);
            _objectContainer.RegisterInstanceAs(eventsApiMessageHandlers);
            _objectContainer.RegisterInstanceAs(tokenApiMessageHandlers);
        }
예제 #2
0
        public async Task CanUseDefaultResponse()
        {
            using (ProviderEventsApi webApi = new ProviderEventsApi(apiMessageHandlers))
            {
                using (HttpClient client = new HttpClient())
                {
                    var jsonresponse = await client.GetAsync(baseAddress + "api/submissions?page=1");

                    var response = JsonConvert.DeserializeObject <PageOfResults <SubmissionEvent> >(jsonresponse.Content.ReadAsStringAsync().Result);
                    Assert.AreEqual(45785214, response.Items[0].ApprenticeshipId);
                }
            }
        }
예제 #3
0
        public async Task CanOverrideDefaultResponse()
        {
            apiMessageHandlers.OverrideGetSubmissionEvents(new PageOfResults <SubmissionEvent> {
                Items = new[] { new SubmissionEvent {
                                    ApprenticeshipId = 45785333,
                                } }, PageNumber = 1, TotalNumberOfPages = 1
            });

            using (ProviderEventsApi webApi = new ProviderEventsApi(apiMessageHandlers))
            {
                using (HttpClient client = new HttpClient())
                {
                    var jsonresponse = await client.GetAsync(baseAddress + "api/submissions?page=1");

                    var response = JsonConvert.DeserializeObject <PageOfResults <SubmissionEvent> >(jsonresponse.Content.ReadAsStringAsync().Result);
                    Assert.AreEqual(45785333, response.Items[0].ApprenticeshipId);
                }
            }
        }