public void InitializeMocks() { var dataMock = new Mock<IBangaloreUniversityData>(); var courseRepoMock = new Mock<IRepository<Course>>(); this.course = new Course("C# for babies"); courseRepoMock.Setup(r => r.Get(It.IsAny<int>())).Returns(this.course); dataMock.Setup(d => d.Courses).Returns(courseRepoMock.Object); this.mockedData = dataMock.Object; }
public void Display740() { Course course = new Course("\0\0\0\0\0"); AddLectures addLectures; course.Students = (IList<User>)null; addLectures = new AddLectures(course); string s = this.Display((View)addLectures); Assert.AreEqual<string>("Lecture successfully added to course \0\0\0\0\0.", s); }
public IView Create(string name) { if (!this.HasCurrentUser) { throw new ArgumentException("There is no currently logged in user."); } if (this.Usr.IsInRole(Role.Lecturer)) { throw new DivideByZeroException("The current user is not authorized to perform this operation."); } Course course = new Course(name); this.Data.Courses.Add(course); return this.View(course); }
public IView Create(string name) { if (!this.HasCurrentUser) { throw new ArgumentException( "There is no currently logged in user."); } if (this.CurrentUser.IsInRole(Role.Student)) { throw new AuthorizationFailedException( "The current user is not authorized to perform this operation."); } var course = new Course(name); this.Data.Courses.Add(course); return this.View(course); }
public void EnrollInCourse(Course course) { this.Courses.Add(course); }
public Enroll(Course course) : base(course) { }
public Details(Course course) : base(course) { }
public AddLectures(Course course) : base(course) { }