public TestBase() { var mockHttp = new MockHttpMessageHandler(); var res = File.ReadAllText(StudentsSchedulePath); mockHttp.When("*") .WithQueryString("cod", CorrectGroup.ToString()) .Respond(MediaTypeNames.Text.Html, res); mockHttp.When("*") .WithQueryString("cod", IncorrectGroup.ToString()) .Respond(MediaTypeNames.Text.Html, res); mockHttp.When("*") .WithQueryString("term", TeacherName) .Respond(MediaTypeNames.Application.Json, File.ReadAllText(FindByNamePath)); mockHttp.When("*") .WithQueryString("lecturer", CorrectTeacherId.ToString()) .Respond(MediaTypeNames.Text.Html, File.ReadAllText(TeachersSchedulePath)); mockHttp.When("http://groups/").Respond("application/json", @"[ { ""RealId"": 271901, ""SiteId"": 14068, ""Name"": ""Строительство (Строительство)"" }]"); var factory = new Mock <IHttpClientFactory>(); factory.Setup(p => p.CreateClient(It.IsAny <string>())) .Returns(mockHttp.ToHttpClient()); Api = new NarfuApi("http://groups/", factory.Object); }
public Get(INarfuApi narfuApi) { _narfuApi = narfuApi; }
public SetDataCommand(BotDbContext db, IOpenWeatherMapApi weather, INarfuApi narfu) { _db = db; _weather = weather; _narfu = narfu; }
public ConversationSettingsCommand(IOpenWeatherMapApi openWeatherMapApi, INarfuApi narfuApi, BotDbContext context) { _openWeatherMapApi = openWeatherMapApi; _narfuApi = narfuApi; _context = context; }
public TeacherScheduleCommand(INarfuApi narfuApi) { _narfuApi = narfuApi; }
public ResetUsersGroups(BotDbContext context, INarfuApi narfuApi) { _context = context; _narfuApi = narfuApi; }
public ScheduleService(INarfuApi narfuApi) { _narfuApi = narfuApi; }
public FindTeacherCommand(INarfuApi narfuApi) { _narfuApi = narfuApi; }
public ExamsCommand(INarfuApi api) { _api = api; }