public async Task When_GetSessionWithNoContent_Return_Exception() { var restClient = Substitute.For <IRestClient>(); restClient.LastResponse = new RestClient.APIResponse(new HttpResponseMessage(HttpStatusCode.NoContent)); DssService = new DssService(restClient, DssSettings, Logger); DssService.Invoking(sut => sut.GetSessions("993cfb94-12b7-41c4-b32d-7be9331174f1", "saddasdsadsa")) .Should().Throw <DssException>(); }
public async Task When_AdviserDetailsWithNoContent_Throw_Exception() { var restClient = Substitute.For <IRestClient>(); restClient.LastResponse = new RestClient.APIResponse(new HttpResponseMessage(HttpStatusCode.NoContent)); DssService = new DssService(restClient, DssSettings, Logger); DssService.Invoking(sut => sut.GetGoalDetails("customerId", "interactionId2", "actionPlanId", "goalId")) .Should().Throw <DssException>(); }
public async Task When_GetSessionErrors_Return_Exception() { var restClient = Substitute.For <IRestClient>(); restClient.GetAsync <List <Session> >(Arg.Any <string>(), Arg.Any <HttpRequestMessage>()).ThrowsForAnyArgs(new Exception("error")); DssService = new DssService(restClient, DssSettings, Logger); DssService.Invoking(sut => sut.GetSessions("993cfb94-12b7-41c4-b32d-7be9331174f1", "saddasdsadsa")) .Should().Throw <DssException>(); Logger.ReceivedCalls().Count().Equals(1); }
public async Task When_AdviserDetailsErrors_Throw_Exception() { var restClient = Substitute.For <IRestClient>(); restClient.LastResponse = new RestClient.APIResponse(new HttpResponseMessage(HttpStatusCode.NoContent)); DssService = new DssService(restClient, DssSettings, Logger); restClient.GetAsync <Goal>(Arg.Any <string>(), Arg.Any <HttpRequestMessage>()).ThrowsForAnyArgs(new Exception("error")); DssService.Invoking(sut => sut.GetGoalDetails("customerId", "interactionId2", "actionPlanId", "goalId")) .Should().Throw <DssException>(); Logger.ReceivedCalls().Count().Equals(1); }
public async Task When_GetInteractionDetailsErrors_Return_EmptyList() { var restClient = Substitute.For <IRestClient>(); restClient.LastResponse = new RestClient.APIResponse(new HttpResponseMessage(HttpStatusCode.NoContent)); DssService = new DssService(restClient, DssSettings, Logger); restClient.GetAsync <Interaction>(Arg.Any <string>(), Arg.Any <HttpRequestMessage>()).ThrowsForAnyArgs(new Exception("error")); DssService.Invoking(sut => sut.GetInteractionDetails("993cfb94-12b7-41c4-b32d-7be9331174f1", "saddasdsadsa")) .Should().Throw <DssException>(); Logger.ReceivedCalls().Count().Equals(1); }
public async Task When_GetGoalsDataWithNoContent_Return_Exception() { var restClient = Substitute.For <IRestClient>(); restClient.LastResponse = new RestClient.APIResponse(new HttpResponseMessage(HttpStatusCode.NoContent)); DssService = new DssService(restClient, DssSettings, Logger); restClient.GetAsync <List <Goal> >(Arg.Any <string>(), Arg.Any <HttpRequestMessage>()).ThrowsForAnyArgs(new Exception("error")); DssService.Invoking(sut => sut.GetGoals("customer", "interactionid", "actionplanid")) .Should().Throw <DssException>(); Logger.ReceivedCalls().Count().Equals(1); }