Exemple #1
0
        public async Task TestGetGeoIP() {
            using (YuYanDBContext db = new YuYanDBContext())
            using (YuYanDBRepository repos = new YuYanDBRepository(db))
            {
                YuYanService svc = new YuYanService(repos);
                var controller = new ClientController(svc);

                var result = await controller.GetGeoIP("121.214.23.68");
                Assert.IsNotNull(result);
            }
        }
Exemple #2
0
        public async Task TestService_LogoutUser_Success() {
            using (YuYanDBContext db = new YuYanDBContext())
            using (YuYanDBRepository repos = new YuYanDBRepository(db))
            {
                YuYanService svc = new YuYanService(repos);

                bool isLogout = await svc.LogoutUser(new Guid("1A737355-2BF8-4CF6-AB28-A2694CD2A0D8"));

                Assert.AreEqual(true, isLogout);
            }
        }
Exemple #3
0
 public async Task TestService_LoginUser_Failed_NoUser()
 {
     using (YuYanDBContext db = new YuYanDBContext())
     using (YuYanDBRepository repos = new YuYanDBRepository(db))
     {
         YuYanService svc = new YuYanService(repos);
         dtoUser newUser = new dtoUser() { Email = "*****@*****.**", Password = "******" };
         dtoUserProfile userObj = await svc.LoginUser(newUser);
         Assert.IsNull(userObj);
     }
 }
Exemple #4
0
 public async Task TestService_LoginUser_Success() {
     using (YuYanDBContext db = new YuYanDBContext())
     using (YuYanDBRepository repos = new YuYanDBRepository(db))
     {
         YuYanService svc = new YuYanService(repos);
         dtoUser newUser = new dtoUser() { Email = "*****@*****.**", Password = "******" };
         dtoUserProfile userObj = await svc.LoginUser(newUser);
         Assert.IsNotNull(userObj);
         Assert.AreEqual("*****@*****.**", userObj.Email);
     }
 }
Exemple #5
0
        public async Task TestController_GetSurveyBySurveyId()
        {
            using (YuYanDBContext db = new YuYanDBContext())
            using (YuYanDBRepository repos = new YuYanDBRepository(db))
            {
                YuYanService svc = new YuYanService(repos);
                var controller = new SurveyController(svc);

                var result = await controller.GetSurveyBySurveyId(92);
                Assert.IsNotNull(result);
            }
        }
Exemple #6
0
 public async Task TestService_LoginUser_Failed_WrongPassword()
 {
     using (YuYanDBContext db = new YuYanDBContext())
     using (YuYanDBRepository repos = new YuYanDBRepository(db))
     {
         YuYanService svc = new YuYanService(repos);
         dtoUser newUser = new dtoUser() { Email = "*****@*****.**", Password = "******" };
         dtoUserProfile userObj = await svc.LoginUser(newUser);
         Assert.IsNotNull(userObj);
         Assert.AreEqual(Guid.Empty, userObj.UserId);
     }
 }
Exemple #7
0
        public async Task TestController_CreateQuestion() { 
            using(YuYanDBContext db = new YuYanDBContext())
            using (YuYanDBRepository repos = new YuYanDBRepository(db)) {
                YuYanService svc = new YuYanService(repos);
                var controller = new SurveyController(svc);

                dtoSurveyQuestion questionObj = new dtoSurveyQuestion();
                questionObj.Question = "Add from Test";
                questionObj.QuestionType = QuestionType.checkbox;
                //questionObj.SurveyId = 6;

                var result = await controller.CreateQuestion(6, questionObj);
                Assert.IsNotNull(result);
            }
        }
Exemple #8
0
        public async Task TestController_CreateSurvey() {
            using (YuYanDBContext db = new YuYanDBContext())
            using (YuYanDBRepository repos = new YuYanDBRepository(db))
            {
                YuYanService svc = new YuYanService(repos);
                var controller = new SurveyController(svc);

                dtoSurvey testObj = new dtoSurvey();
                testObj.Title = "Make me happy";
                testObj.ShortDesc = "No short description";

                var result = await controller.CreateSurvey(testObj);
                Assert.IsNotNull(result);
            }
        }
Exemple #9
0
 public async Task TestService_GetSurveyBySurveyId()
 {
     using (YuYanDBContext db = new YuYanDBContext())
     using (YuYanDBRepository repos = new YuYanDBRepository(db))
     {
         YuYanService svc = new YuYanService(repos);
         dtoSurvey obj = await svc.GetSurveyBySurveyId(1);
         Assert.IsNotNull(obj);
     }
 }
Exemple #10
0
 public async Task TestService_DeleteSurveyQuestion() {
     using (YuYanDBContext db = new YuYanDBContext())
     using (YuYanDBRepository repos = new YuYanDBRepository(db))
     {
         YuYanService svc = new YuYanService(repos);
         await svc.DeleteSurveyQuestion(1);
         
     }
 }