Пример #1
0
        public void ShouldSolveRequest()
        {
            var usersBL = new UsersBL();
            usersBL.InsertUser("busaco", "busaco", "*****@*****.**", UserTypes.Teacher);
            usersBL.InsertUser("info.uaic", "info.uaic", "info.uaic", UserTypes.Faculty);

            var teacherRequestsBL = new TeacherRequestsBL();
            var teacherRequest = new TeacherRequest
                                     {
                                         DateSent = DateTime.Now,
                                         FacultyUsername = "******",
                                         TeacherUsername = "******"
                                     };
            var list = teacherRequestsBL.GetRequestsByFaculty("info.uaic");
            int length = -1;
            if (list != null) length = list.Count;
            teacherRequestsBL.InsertPendingTeacherRequest(teacherRequest);
            list = teacherRequestsBL.GetRequestsByFaculty("info.uaic");

            if (list != null) Assert.AreEqual(length + 1, list.Count);
            else Assert.Fail();

            teacherRequestsBL.SolveRequest(teacherRequest);

            list = teacherRequestsBL.GetRequestsByFaculty("info.uaic");

            // usersBL.DeleteUser("busaco", "busaco");
            // usersBL.DeleteUser("info.uaic", "info.uaic");

            if (list != null) Assert.AreEqual(length, list.Count);
            else Assert.Fail();
        }
Пример #2
0
 public void ShouldDeleteUser()
 {
     var bl = new UsersBL();
     bl.InsertUser("ohgoahrgorei", "ohgoahrgorei", "*****@*****.**", UserTypes.Student);
     bl.DeleteUser("ohgoahrgorei", "ohgoahrgorei");
     User user = bl.GetUser("ohgoahrgorei", "ohgoahrgorei");
     Assert.IsNull(user);
 }
Пример #3
0
 public void ShouldInsertComplexStudent()
 {
     var student = new Student
                       {
                           Email = "*****@*****.**",
                           Name = "Adrian Marinica",
                           Id = "Adrian3",
                           IsApproved = true,
                           IsLockedOut = false,
                           Notifications = new List<UserNotification>
                                               {
                                                   new UserNotification
                                                       {NotificationId = "1", UserSolved = false},
                                                   new UserNotification
                                                       {NotificationId = "2", UserSolved = false}
                                               },
                           SubscribedWebsites = new List<string>
                                                    {
                                                        "http://info.uaic.ro/~busaco/",
                                                        "http://info.uaic.ro/~rvlad/"
                                                    },
                           SubscribedGroups = new List<string>
                                                  {
                                                      "asfsagasgagas",
                                                      "asdbsdvsdvwe"
                                                  },
                           SubscribedFaculties = new List<string>
                                                     {
                                                         "info.uaic.ro"
                                                     },
                           FailedSubjects = new List<string>
                                                {
                                                     "4fcd249affd8e810ecc3c15f"
                                                },
                           OptionalSubjects = new List<string>
                                                  {
                                                      "4fcd249affd8e810ecc3c15e"
                                                  }
                       };
     var usersBL = new UsersBL();
     usersBL.InsertUser(student);
 }
Пример #4
0
 public void ShouldInsertUserOnlyOnceAndThenDeleteIt()
 {
     var bl = new UsersBL();
     bl.InsertUser("ohgoahrgorei", "ohgoahrgorei", "*****@*****.**", UserTypes.Student);
     bool actual = bl.InsertUser("ohgoahrgorei", "ohgoahrgorei", "*****@*****.**", UserTypes.Student);
     bl.DeleteUser("ohgoahrgorei", "ohgoahrgorei");
     Assert.IsFalse(actual);
     Assert.IsFalse(bl.ValidateUser("ohgoahrgorei", "ohgoahrgorei", UserTypes.Student));
 }
Пример #5
0
 public void ShouldValidateUser()
 {
     var bl = new UsersBL();
     bl.InsertUser("ohgoahrgorei", "ohgoahrgorei", "*****@*****.**", UserTypes.Student);
     Assert.IsTrue(bl.ValidateUser("ohgoahrgorei", "ohgoahrgorei", UserTypes.Student));
     Assert.IsFalse(bl.ValidateUser("ohgoahrgorei", "ohgoahrgorei111", UserTypes.Student));
     bl.DeleteUser("ohgoahrgorei", "ohgoahrgorei");
     Assert.IsFalse(bl.ValidateUser("ohgoahrgorei", "ohgoahrgorei", UserTypes.Student));
 }