public ActionResult GetCoursesForLecturer(long lecturerId, long departmentId) { var courses = new CourseFactory().GetAllCoursesForADepartment(departmentId); var lecturerCourses = courses.Where(n => n.AppUserId == lecturerId); return(View("Index", lecturerCourses)); }
// Update course public static CourseUpdate.Response Handle(IRepository repository, CourseUpdate.Request request) { var container = CourseFactory.CreatePartial(request.CommandModel.CourseID).Modify(request.CommandModel); var validationDetails = repository.Save(container); return(new CourseUpdate.Response(validationDetails)); }
public void UpdateCourse_NewObject_ThrowsObjectNotFound() { var testClass = InteractorFactory.Create_CourseInteractor(); var testScore = CourseFactory.Create_CourseEntity_ValidMinimum(); Should.Throw <ObjectNotFoundException>(() => testClass.UpdateCourse(testScore)); }
public List <Course> Get(string courseParameter = "BCAD") { CourseFactory courseFactory = new CourseFactory(); ICourseManager courseManager = courseFactory.GetIcourse(courseParameter); List <Course> bcadReturnedData = courseManager.getCourseData(); return(bcadReturnedData); }
public CourseEntity GetCourse(Guid courseId) { if (courseId.Equals(Guid.Empty)) { throw new ObjectNotFoundException(); } return(CourseFactory.Create_CourseEntity_ValidMinimum(courseId)); }
public void CreateCourse_ValidModel_ResultNotNull() { var testClass = ServiceFactory.Create_MockInteractor(); var testModel = CourseFactory.Create_CreateCourseDomainModel_ValidMinimum(); var result = testClass.CreateCourse(testModel); result.ShouldNotBeNull(); }
// Delete course public static CourseDelete.Response Handle(IRepository repository, CourseDelete.Request request) { var course = CourseFactory.CreatePartial(request.CommandModel.CourseId); var container = course.Delete(); repository.Save(container); return(new CourseDelete.Response()); }
public void CreateCourse_ValidModel_ResultNotNull() { var testClass = InteractorFactory.Create_CourseInteractor(); var testModel = CourseFactory.Create_CourseEntity_ValidMinimum(); var result = testClass.CreateCourse(testModel); result.ShouldNotBeNull(); }
public List <CourseEntity> GetCoursesByStudentId(Guid userId) { if (userId.Equals(Guid.Empty)) { throw new BadInfoException(); } return(CourseFactory.Create_TwoCourseEntities_ValidMinimum_CustomStudentId(userId)); }
public void UpdateCourse_ValidModel_ReturnsValidModel() { var testCourseId = Guid.NewGuid(); var testCourseEntity = CourseFactory.Create_CourseEntity_ValidMinimum(testCourseId); var testCourseModel = new CreateOrEditCourseDomainModel(testCourseEntity); var testClass = ServiceFactory.Create_MockInteractor(); var result = testClass.UpdateCourse(testCourseModel); result.GetType().ShouldNotBe(typeof(ErrorDomainModel)); }
static void Main() { //using (var sw = new StreamWriter("../../test.out.txt")) //{ // Console.SetOut(sw); CourseFactory factory = new CourseFactory(); ICourse css = factory.CreateLocalCourse("CSS", null, "Ultimate"); Console.WriteLine(css); //} }
public void GetCourse_ValidModel_ResultNotNull() { var testRepo = new MockRepository <CourseEntity>(); var testCourse = CourseFactory.Create_CourseEntity_ValidMinimum(); var testGuid = testRepo.Create(testCourse); var testClass = InteractorFactory.Create_CourseInteractor(testRepo); var result = testClass.GetCourse(testGuid); result.Name.ShouldNotBe(string.Empty); }
public void CreateNewSemesterTest() { //Arrange: if adding to the new semester fails, it will throw an exception and the test will fail. // Act Semester semester = new Semester(); semester.SemesterStart = Convert.ToDateTime("2019,01,01"); CourseFactory factory = new CourseFactory(); factory.AddNewSemesterToDB(semester); //Assert is empty as it is a void method that results in an exception if the method fails. }
public void DeleteCourse_ValidGuid_RemovesCourse() { var studentId = Guid.NewGuid(); var testList = CourseFactory.Create_TwoCourseEntities_ValidMinimumAndId_CustomStudentId(studentId); var testRepo = new MockRepository <CourseEntity>(testList); var testClass = InteractorFactory.Create_CourseInteractor(); testClass.Repo = testRepo; var testGuid = testRepo.GetAll().First().Id; testClass.DeleteCourse(testGuid); var result = testClass.GetCoursesByStudentId(studentId); result.Count.ShouldBe(1); }
public void CreateNewCourseTest(string subjectName, int courseLengthInHours, DateTime courseStart, int subjectConsecutive, string name) { // Arrange phase is empty: Testing a bool return value // Act CourseFactory factory = new CourseFactory(); Subject subject = new Subject { Name = subjectName, ConsecutiveSemesters = subjectConsecutive }; Assert.InRange(subject.ConsecutiveSemesters, 0, 6); bool result = factory.CreateNewCourse(name, courseLengthInHours, courseStart, subject); //Assert Assert.True(result); }
public void GetCoursesByStudentId_ValidGuid_GetsOneCourse() { var testRepo = new MockRepository <CourseEntity>(); var testStudentId = Guid.NewGuid(); var testCourseOne = CourseFactory.Create_CourseEntity_ValidMinimum_CustomStudentId(testStudentId); var testCourseTwo = CourseFactory.Create_CourseEntity_ValidMinimum_CustomStudentId(Guid.NewGuid()); testRepo.Create(testCourseOne); testRepo.Create(testCourseTwo); var testClass = InteractorFactory.Create_CourseInteractor(testRepo); var result = testClass.GetCoursesByStudentId(testStudentId); result.Count.ShouldBe(1); }
public void GetCoursesByStudentId_ValidGuid_GetsTwoCourses() { var testRepo = new MockRepository <CourseEntity>(); var testStudentId = Guid.NewGuid(); var testCourses = CourseFactory.Create_TwoCourseEntities_ValidMinimum_CustomStudentId(testStudentId); foreach (var courseEntity in testCourses) { testRepo.Create(courseEntity); } var testClass = InteractorFactory.Create_CourseInteractor(testRepo); var result = testClass.GetCoursesByStudentId(testStudentId); result.Count.ShouldBe(2); }
// Create course public static CourseCreate.Response Handle(IRepository repository, CourseCreate.Request request) { // Validation now performed in the dispacther decorators (See AutoValidate<T> in the DomainBootstrapper class) var container = new EntityStateWrapperContainer(); container.AddEntity(CourseFactory.Create(request.CommandModel)); var validationDetails = repository.Save(container); var courseId = default(int?); if (!validationDetails.HasValidationIssues) { courseId = container.FindEntity <Course>().CourseID; } return(new CourseCreate.Response(validationDetails, courseId)); }
public IView Create(string name) { if (!this.HasCurrentUser) { throw new ArgumentException("There is no currently logged in user."); } if (this.User.IsInRole(Role.Lecturer)) { throw new DivideByZeroException("The current user is not authorized to perform this operation."); } var course = CourseFactory.CreateCourse(name); this.Data.Courses.Add(course); return(this.View(course)); }
public static void Main(string[] args) { String selection = Console.ReadLine(); AbstractCourse course = CourseFactory.CreateCourse(selection); course.DisplayCourseDetails(); String courseName = Console.ReadLine(); var offlineCourseFactory = new OnlineCourseFactory(); AbstractCourse abstractCourse = offlineCourseFactory.CreateCourse(courseName); abstractCourse.DisplayCourseDetails(); courseName = Console.ReadLine(); var onlineCourseFactory = new OnlineCourseFactory(); abstractCourse = onlineCourseFactory.CreateCourse(courseName); abstractCourse.DisplayCourseDetails(); Console.ReadKey(); }
public void UpdateCourse_ValidObject_UpdatesCourse() { var studentId = Guid.NewGuid(); var testList = CourseFactory.Create_TwoCourseEntities_ValidMinimumAndId_CustomStudentId(studentId); var testRepo = new MockRepository <CourseEntity>(testList); var testClass = InteractorFactory.Create_CourseInteractor(); testClass.Repo = testRepo; var courseToUpdate = testRepo.GetAll().First(); var updatedCourse = new CourseEntity { Id = courseToUpdate.Id, Name = "Intermediate Physics", Number = "1265" }; testClass.UpdateCourse(updatedCourse); var result = testClass.GetCourse(courseToUpdate.Id); result.LastModified.ShouldNotBeSameAs(courseToUpdate.LastModified); result.Name.ShouldBe("Intermediate Physics"); result.Number.ShouldBe("1265"); }
public void AddCourseToSemesterTest(DateTime semesterStart) { // Arrange phase is empty: Testing a bool return value // Act CourseFactory factory = new CourseFactory(); Subject subject = new Subject { Name = "Matematik", ConsecutiveSemesters = 5 }; DateTime courseStart = new DateTime(2019, 01, 01); Course course = new Course { Name = "Matematik a niveau", CourseLenghtInHours = 60, CourseSubject = subject, CourseStart = courseStart }; Semester semester = new Semester { SemesterStart = semesterStart }; semester.ListOfCourses = new List <Course>(); //Assert bool result = factory.AddCourseToSemester(semester, course); Assert.True(result); }
public override FloorList CreateFloorList(CourseFactory cf) { FloorList floors = new FloorList (new FlatFloor (Vector3.up, Vector3.zero, Vector3.forward, 10f, 20f), cf) .Flat(110f) .Upslope (50f, Mathf.PI / 2f, 0f) .Flat (20f) .Incline (80f, 0f, Mathf.PI) .Incline (80f, 0f, Mathf.PI) .Flat (100f) .SuperAccelerator() .SlopeTop (25f, Mathf.PI, 0f) .Flat (120f) .Downslope (50f, Mathf.PI, Mathf.PI / 2f) .Incline (50f, 0f, Mathf.PI / 8f) .OrbitY (80f, 21f, 0f, Mathf.PI / 2f, Mathf.PI / 8f, Vector3.right) .OrbitY (80f, 21f, Mathf.PI / 2f, Mathf.PI, Mathf.PI / 8f, Vector3.forward) .OrbitY (80f, 21f, Mathf.PI, Mathf.PI * 3f / 2f, Mathf.PI / 8f, -Vector3.right) .OrbitY (80f, 21f, Mathf.PI * 3f / 2f, Mathf.PI * 2f, Mathf.PI / 8f, -Vector3.forward) .Incline (40f, 0f, -Mathf.PI / 8f) .Upslope (50f, Mathf.PI / 2f, 0) .Flat(30f) .SlopeTop (25f, Mathf.PI, Mathf.PI / 2f) .SlopeTop (25f, Mathf.PI / 2f, 0f) .LandingSite() .Flat(30f) .Downslope (50f, Mathf.PI, Mathf.PI / 2f) .Incline (40f, 0f, Mathf.PI / 8f) .OrbitY (80f, 0f, 0f, Mathf.PI / 2f, Mathf.PI / 8f, Vector3.right) .Incline (40f, 0f, -Mathf.PI / 8f) .SlopeTop (100f, Mathf.PI / 2f, 0f) .Flat(115f) .Downslope (30f, Mathf.PI, Mathf.PI / 2f) .Incline (40f, 0f, Mathf.PI / 8f) .OrbitY (80f, 0f, Mathf.PI / 2f, Mathf.PI, Mathf.PI / 8f, Vector3.forward) .Flat(60f) .OrbitY (80f, 0f, Mathf.PI, Mathf.PI * 3f / 2f, Mathf.PI / 8f, -Vector3.right) .Incline (40f, 0f, -Mathf.PI / 4f) .OrbitY (80f, 0f, Mathf.PI / 2f, Mathf.PI * 3f / 2f, Mathf.PI / 8f, -Vector3.forward, false) .Incline (40f, 0f, Mathf.PI / 4f) .OrbitY (80f, 0f, Mathf.PI / 2f, Mathf.PI * 3f / 2f, Mathf.PI / 8f, Vector3.forward) .Incline (40f, 0f, -Mathf.PI / 4f) .OrbitY (80f, 0f, Mathf.PI / 2f, Mathf.PI, Mathf.PI / 8f, -Vector3.forward, false) .Incline (20f, 0f, Mathf.PI / 8f) .Incline (60f, 0f, Mathf.PI / 8f) .OrbitY (85f, 0f, Mathf.PI, Mathf.PI * 3f / 2f, Mathf.PI / 8f, -Vector3.right) .OrbitY (85f, 0f, Mathf.PI * 3f / 2f, Mathf.PI * 2f, Mathf.PI / 8f, -Vector3.forward) .Incline (40f, 0f, -Mathf.PI / 8f) .Close () .Agari(); return floors; }
public override FloorList CreateFloorList(CourseFactory cf) { FloorList floors = new FloorList (new FlatFloor (Vector3.up, Vector3.zero, Vector3.forward, 40f, 20f), cf) .Incline (40f, 0f, Mathf.PI / 8f) .OrbitY (80f, 0f, 0f, Mathf.PI / 2f, Mathf.PI / 8f, Vector3.right) .Horse() .Flat (50f) .OrbitY (80f, 21f, Mathf.PI / 2f, Mathf.PI, Mathf.PI / 8f, Vector3.forward) .OrbitY (80f, 21f, Mathf.PI, Mathf.PI * 3f / 2f, Mathf.PI / 8f, -Vector3.right) .OrbitY (80f, 21f, Mathf.PI * 3f / 2f, Mathf.PI * 2f, Mathf.PI / 8f, -Vector3.forward) .OrbitY (80f, 21f, 0f, Mathf.PI / 2f, Mathf.PI / 8f, Vector3.right) .OrbitY (80f, 21f, Mathf.PI / 2f, Mathf.PI, Mathf.PI / 8f, Vector3.forward) .OrbitY (80f, 21f, Mathf.PI, Mathf.PI * 3f / 2f, Mathf.PI / 8f, -Vector3.right) .Incline (40f, 0f, -Mathf.PI / 8f) .Upslope (50f, Mathf.PI / 2f, 0f) .Flat (20f) .SlopeTop (20f, Mathf.PI, 0f) .Flat (20f) .Downslope (50f, Mathf.PI, Mathf.PI / 2f) .Flat (40f) .Horse() .Incline (40f, 0f, -Mathf.PI / 8f) .OrbitY (80f, -21f, Mathf.PI / 2f, Mathf.PI, Mathf.PI / 8f, -Vector3.forward, false) .OrbitY (80f, -21f, Mathf.PI, Mathf.PI * 3f / 2f, Mathf.PI / 8f, -Vector3.right, false) .OrbitY (80f, -21f, Mathf.PI * 3f / 2f, Mathf.PI * 2f, Mathf.PI / 8f, Vector3.forward, false) .OrbitY (80f, -21f, 0f, Mathf.PI / 2f, Mathf.PI / 8f, Vector3.right, false) .OrbitY (80f, -21f, Mathf.PI / 2f, Mathf.PI, Mathf.PI / 8f, -Vector3.forward, false) .OrbitY (80f, -21f, Mathf.PI, Mathf.PI * 3f / 2f, Mathf.PI / 8f, -Vector3.right, false) .Flat (50f) .OrbitY (80f, 0f, Mathf.PI * 3f / 2f, Mathf.PI * 2f, Mathf.PI / 8f, Vector3.forward, false) .Incline (40f, 0f, Mathf.PI / 8f) .Flat (10F) .Close () .Agari(); return floors; }
public abstract FloorList CreateFloorList(CourseFactory cf);
public FloorList(Floor head, CourseFactory factory) { Head = head; Last = head; this.factory = factory; }
// Use this for initialization void Start() { keyConfig = KeyConfig.Current; soundManager = GameObject.Find ("UserInterface").GetComponent<SoundManager> (); courseFactory = GameObject.Find ("Course").GetComponent<CourseFactory> (); courseFactory.CreateCourse (); if (!IsObj) { lastIntersectedFloor = courseFactory.Floor; } if (IsSushi) { switchableSushi = GetComponentInChildren<SwitchableSushi> (); switchableSushi.InitializeRenderer (); if (IsAI) { int maxSushi = Enum.GetValues (typeof(SushiType)).Length; int sushiType = UnityEngine.Random.Range (0, maxSushi); switchableSushi.SwitchSushi ((SushiType)sushiType); } else { switchableSushi.SwitchSushi (Global.CurrentSushiType); SushiSpec spec = SushiSpecProvider.Provide (Global.CurrentSushiType); maxSpeed = spec.MaxSpeed; acceleration = spec.Acceleration; speedDecrFactor = spec.Weight; } } floatingEffect = GameObject.Find("FloatingEffect").GetComponent<ParticleSystem> (); floatingEffect.enableEmission = false; }
public ActionResult ViewCoursesForDepartment(long id) { var courses = new CourseFactory().GetAllCoursesForADepartment(id); return(View("DeparmentCourses", courses)); }
public ActionResult ViewCoursesForLevel(long levelId, long departmentId) { var courses = new CourseFactory().GetAllCoursesForALevel(levelId, departmentId); return(View("LevelCorses", courses)); }
public ActionResult GetCoursesForFacilitator(long departmentId) { var courses = new CourseFactory().GetAllCoursesForADepartment(departmentId); return(View("Index", courses)); }