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;
        }
示例#2
0
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);
}
示例#3
0
        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);
        }
示例#5
0
 public void EnrollInCourse(Course course)
 {
     this.Courses.Add(course);
 }
示例#6
0
 public Enroll(Course course)
     : base(course)
 {
 }
示例#7
0
 public Details(Course course)
     : base(course)
 {
 }
示例#8
0
 public AddLectures(Course course)
     : base(course)
 {
 }