public void Test_Task_GetPolly_Positive() { var eventBus = new Mock <IEventBus>(); var httpClient = new HttpClient(); var logger = new Mock <ILogger <TemplateController> >(); var saveresponse = new Mock <IKafkaResponseRepository>(); httpClient.BaseAddress = new Uri("http://localhost"); // var identityService = new Mock<IdentityService>(MockBehavior.Default, httpClient); var identityService = new Mock <HttpClientFactory>(); TemplateController controller = new TemplateController(eventBus.Object, identityService.Object, saveresponse.Object, logger.Object); try { var result = controller.GetPolly().GetAwaiter().GetResult(); Assert.Equal(200, ((ObjectResult)result).StatusCode); } catch (Exception) { } }