public void Setup() { server = new QuickCoursesTestServer(); server.UseCourses(TestCourses.CreateBasicSample()); server.UseUsers(TestUsers.CreateSuperUserSample(), TestUsers.CreateUserSample()); client = server.CreateClient(); }
public CreateTopicModel(string topicName, int chapterId, IEnumerable <Course> courses, int?testCourseId, IEnumerable <TopicType> testTopicTypes, int?testTopicTypeId, int?theoryCourseId, IEnumerable <TopicType> theoryTopicTypes, int?theoryTopicTypeId) { //Test course TestCourses = courses .Select(item => new SelectListItem { Text = item.Name, Value = item.Id.ToString(), Selected = false }) .ToList(); TestCourses.Insert(0, new SelectListItem() { Text = Localization.getMessage("NoCourse"), Value = Constants.NoCourseId.ToString(), Selected = false }); TestTopicTypes = testTopicTypes .Select(item => new SelectListItem { Text = Converter.ToString(item), Value = item.Id.ToString(), Selected = false }) .ToList(); BindTestCourse = testCourseId.HasValue ? true : false; TestCourseId = testCourseId ?? 0;// ?? Constants.NoCourseId; TestTopicTypeId = testTopicTypeId ?? 0; //Theory course TheoryCourses = courses .Select(item => new SelectListItem { Text = item.Name, Value = item.Id.ToString(), Selected = false }) .ToList(); TheoryTopicTypes = theoryTopicTypes .Select(item => new SelectListItem { Text = Converter.ToString(item), Value = item.Id.ToString(), Selected = false }) .ToList(); BindTheoryCourse = theoryCourseId.HasValue ? true : false; TheoryCourseId = theoryCourseId ?? 0;// ?? Constants.NoCourseId; TheoryTopicTypeId = theoryTopicTypeId ?? 0; TopicName = topicName; ChapterId = chapterId; }
public QuickCoursesClientTests() { server = new QuickCoursesTestServer(); client = new QuickCoursesClient(ApiVersion.V1, "http://api", server.CreateClient()); server.UseUsers(TestUsers.CreateSuperUserSample(), TestUsers.CreateUserSample()); server.UseCourses(TestCourses.CreateBasicSample()); ticket = client.GetTicketAsync(new AuthData { Login = "******", Password = "******" }).Result; courses = client.GetCoursesAsync(ticket).Result; firstCourse = courses.First(); }