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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }