public async Task ExceptionTestFor_GetAllTaskGroups_FailWithException() { List <TaskGroup> result = null; try { //Action result = await _taskService.GetAllTaskGroup(); if (result != null) { testResult = "ExceptionTestFor_GetAllTaskGroups_FailWithException=" + "False"; // Write test case result in text file fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_GetAllTaskGroups_FailWithException", expectedOutput = "False", weight = 2, mandatory = "False", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } else { // Assert Assert.Null(result); } } catch (Exception exception) { var error = exception; testResult = "ExceptionTestFor_GetAllTaskGroups_FailWithException=" + "True"; // Write test case result in text file fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_GetAllTaskGroups_FailWithException", expectedOutput = "True", weight = 2, mandatory = "True", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } }
public async Task <cases> CreateCase(string caseUId, check_lists checkList, DateTime created_at, string custom, DateTime done_at, workers doneByUserId, int microtingCheckId, int microtingUId, sites site, int?status, string caseType, units unit, DateTime updated_at, int version, workers worker, string WorkFlowState) { cases aCase = new cases(); aCase.CaseUid = caseUId; aCase.CheckList = checkList; aCase.CheckListId = checkList.Id; aCase.CreatedAt = created_at; aCase.Custom = custom; aCase.DoneAt = done_at; aCase.WorkerId = worker.Id; aCase.MicrotingCheckUid = microtingCheckId; aCase.MicrotingUid = microtingUId; aCase.Site = site; aCase.SiteId = site.Id; aCase.Status = status; aCase.Type = caseType; aCase.Unit = unit; aCase.UnitId = unit.Id; aCase.UpdatedAt = updated_at; aCase.Version = version; aCase.Worker = worker; aCase.WorkflowState = WorkFlowState; dbContext.cases.Add(aCase); await dbContext.SaveChangesAsync().ConfigureAwait(false); return(aCase); }
public async Task BusinessTestFor_GetAllTask_Successed() { List <TaskItem> result = null; try { //Action result = await _taskService.GetAllTask(); if (result.Count != 0) { testResult = "BusinessTestFor_GetAllTask_Successed=" + "True"; // Write test case result in text file fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Business", Name = "BusinessTestFor_GetAllTask_Successed", expectedOutput = "True", weight = 2, mandatory = "True", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } else { // Assert Assert.InRange(result.Count, 1, 30); } } catch (Exception exception) { var error = exception; testResult = "BusinessTestFor_GetAllTask_Successed=" + "False"; // Write test case result in text file fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Business", Name = "BusinessTestFor_GetAllTask_Successed", expectedOutput = "False", weight = 2, mandatory = "False", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } }
public void SQL_Case_CaseDeleteResult_DoesMarkCaseRemoved() { // Arrance sites site = new sites(); site.name = "SiteName"; DbContext.sites.Add(site); DbContext.SaveChanges(); check_lists cl = new check_lists(); cl.label = "label"; DbContext.check_lists.Add(cl); DbContext.SaveChanges(); cases aCase = new cases(); aCase.microting_uid = "microting_uid"; aCase.microting_check_uid = "microting_check_uid"; aCase.workflow_state = Constants.WorkflowStates.Created; aCase.check_list_id = cl.id; aCase.site_id = site.id; DbContext.cases.Add(aCase); DbContext.SaveChanges(); // Act sut.CaseDeleteResult(aCase.id); cases theCase = sut.CaseReadFull(aCase.microting_uid, aCase.microting_check_uid); // Assert Assert.NotNull(theCase); Assert.AreEqual(Constants.WorkflowStates.Removed, theCase.workflow_state); }
public field_values CreateFieldValue(cases aCase, check_lists checkList, fields f, int?ud_id, int?userId, string value, int?version, workers worker) { field_values fv = new field_values(); fv.case_id = aCase.id; fv.check_list = checkList; fv.check_list_id = checkList.id; fv.created_at = DateTime.Now; fv.date = DateTime.Now; fv.done_at = DateTime.Now; fv.field = f; fv.field_id = f.id; fv.updated_at = DateTime.Now; if (ud_id != null) { fv.uploaded_data_id = ud_id; } fv.user_id = userId; fv.value = value; fv.version = version; fv.worker = worker; fv.workflow_state = Constants.WorkflowStates.Created; DbContext.field_values.Add(fv); DbContext.SaveChanges(); return(fv); }
public cases CreateCase(string caseUId, check_lists checkList, DateTime created_at, string custom, DateTime done_at, workers doneByUserId, string microtingCheckId, string microtingUId, sites site, int?status, string caseType, units unit, DateTime updated_at, int version, workers worker, string WorkFlowState) { cases aCase = new cases(); aCase.case_uid = caseUId; aCase.check_list = checkList; aCase.check_list_id = checkList.id; aCase.created_at = created_at; aCase.custom = custom; aCase.done_at = done_at; aCase.done_by_user_id = worker.id; aCase.microting_check_uid = microtingCheckId; aCase.microting_uid = microtingUId; aCase.site = site; aCase.site_id = site.id; aCase.status = status; aCase.type = caseType; aCase.unit = unit; aCase.unit_id = unit.id; aCase.updated_at = updated_at; aCase.version = version; aCase.worker = worker; aCase.workflow_state = WorkFlowState; DbContext.cases.Add(aCase); DbContext.SaveChanges(); return(aCase); }
public async Task BoundaryTestFor_ValidUserEmailAsync() { try { Regex regex = new Regex(@"[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$"); bool isEmail = regex.IsMatch(_user.Email); if (isEmail == true) { //Action var result = await _userService.RegisterNewUser(_user); //Write test result in text file String testResult = "BoundaryTestFor_ValidUserEmailAsync= True"; fileUtility.WriteTestCaseResuItInText(testResult); //Write test result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Boundary", Name = "BoundaryTestFor_ValidUserEmailAsync", expectedOutput = "True", weight = 2, mandatory = "True", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } //Assert Assert.True(isEmail); } catch (Exception ex) { var error = ex; //Write test result in text file String testResult = "BoundaryTestFor_ValidUserEmailAsync= False"; fileUtility.WriteTestCaseResuItInText(testResult); //Write test result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Boundary", Name = "BoundaryTestFor_ValidUserEmailAsync", expectedOutput = "False", weight = 2, mandatory = "False", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } }
public async Task BoundaryTestFor_ValidUserNameAsync() { try { //Action var result = await _userService.RegisterNewUser(_user); //Action // await userRepo.RegisterNewUser(_user); // var result = await userRepo.VerifyUser(_userLogin); bool getisUserName = Regex.IsMatch(_user.UserName, @"^[a-zA-Z0-9]{4,10}$", RegexOptions.IgnoreCase); if (getisUserName == true) { //Write test result in text file String testResult = "BoundaryTestFor_ValidUserNameAsync= True"; fileUtility.WriteTestCaseResuItInText(testResult); //Write test result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Boundary", Name = "BoundaryTestFor_ValidUserNameAsync", expectedOutput = "True", weight = 2, mandatory = "True", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } //Assert Assert.True(getisUserName); } catch (Exception ex) { var error = ex; //Write test result in text file String testResult = "BoundaryTestFor_ValidUserNameAsync= False"; fileUtility.WriteTestCaseResuItInText(testResult); //Write test result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Boundary", Name = "BoundaryTestFor_ValidUserNameAsync", expectedOutput = "False", weight = 2, mandatory = "False", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } }
public async Task ExceptionTestFor_GetTaskDashboard_FailWithException() { TaskDashboard result = null; try { //Action result = await _taskService.GetDashboard(); if (result == null && result.TotalGroups == 0 && result.TotalTask == 0 && result.PendingTask == 0 && result.CompletedTask == 0) { testResult = "ExceptionTestFor_GetTaskDashboard_FailWithException=" + "False"; // Write test case result in text file fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_GetTaskDashboard_FailWithException", expectedOutput = "False", weight = 2, mandatory = "False", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } else { // Assert Assert.NotNull(result); } } catch (Exception exception) { var error = exception; testResult = "ExceptionTestFor_GetTaskDashboard_FailWithException=" + "True"; // Write test case result in text file fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_GetTaskDashboard_FailWithException", expectedOutput = "True", weight = 2, mandatory = "True", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } }
public async Task <field_values> CreateFieldValue(cases aCase, check_lists checkList, fields f, int?ud_id, int?userId, string value, int?version, workers worker) { field_values fv = new field_values(); fv.CaseId = aCase.Id; fv.CheckList = checkList; fv.CheckListId = checkList.Id; fv.CreatedAt = DateTime.UtcNow; fv.Date = DateTime.Now; fv.DoneAt = DateTime.Now; fv.Field = f; fv.FieldId = f.Id; fv.UpdatedAt = DateTime.UtcNow; if (ud_id != null) { fv.UploadedDataId = ud_id; } fv.WorkerId = userId; fv.Value = value; fv.Version = version; fv.Worker = worker; fv.WorkflowState = Constants.WorkflowStates.Created; dbContext.field_values.Add(fv); await dbContext.SaveChangesAsync().ConfigureAwait(false); return(fv); }
public async Task ExceptionTestFor_ListOfPaidAndUnpaidBillsNotFound() { try { //Action var getbillList = await _billService.GetAllBillsAsync(); if (getbillList == null) { //Write test result in text file String testResult = "ExceptionTestFor_ListOfPaidAndUnpaidBillsNotFound= False"; fileUtility.WriteTestCaseResuItInText(testResult); //Write test result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_ListOfPaidAndUnpaidBillsNotFound", expectedOutput = "False", weight = 2, mandatory = "False", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } else { //Assert Assert.Empty(getbillList); } } catch (Exception ex) { var error = ex; //Write test result in text file String testResult = "ExceptionTestFor_ListOfPaidAndUnpaidBillsNotFound= True"; fileUtility.WriteTestCaseResuItInText(testResult); //Write test result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_ListOfPaidAndUnpaidBillsNotFound", expectedOutput = "True", weight = 2, mandatory = "True", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } }
public async Task BoundaryTestFor_GroupColor_Require() { try { if (taskGroup.Active != null) { //Action var result = await _taskService.NewTaskGroup(taskGroup); if (result == "New Group Added") { testResult = "BoundaryTestFor_GroupColor_Require=" + "True"; // Write test case result in text file fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Boundary", Name = "BoundaryTestFor_GroupColor_Require", expectedOutput = "True", weight = 2, mandatory = "True", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } } else { // Assert Assert.NotNull(taskGroup.Color); } } catch (Exception exception) { var error = exception; testResult = "BoundaryTestFor_GroupColor_Require=" + "False"; // Write test case result in text file fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Boundary", Name = "BoundaryTestFor_GroupColor_Require", expectedOutput = "False", weight = 2, mandatory = "False", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } }
public async Task BoundaryTestFor_ValidSkillName() { try { bool isSkillNameValid = true; if (_skill.SkillName != "") { long f; isSkillNameValid = long.TryParse(_skill.SkillName, out f); if (isSkillNameValid == false) { var result = _skillService.AddNewSkill(_skill); testResult = "BoundaryTestFor_ValidSkillName=" + "True"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Boundary", Name = "TestFor_ValidSkillName", expectedOutput = "True", weight = 5, mandatory = "True", desc = "expecting to create new skill after validating skill name as non-numeric only" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } } else { Assert.False(isSkillNameValid); } } catch (Exception exception) { var res = exception.Message; testResult = "BoundaryTestFor_ValidSkillName=" + "False"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Boundary", Name = "TestFor_ValidSkillName", expectedOutput = "False", weight = 1, mandatory = "False", desc = "expecting to create new skill after validating skill name as non-numeric only but fail" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } }
public async Task ExceptionTestFor_EditTask_FailWithException() { try { taskItem = null; //Action var result = await _taskService.EditTask(taskItem); if (result != 0) { testResult = "ExceptionTestFor_EditTask_FailWithException=" + "False"; // Write test case result in text file fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_EditTask_FailWithException", expectedOutput = "False", weight = 2, mandatory = "False", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } else { // Assert Assert.Equal(0, result); } } catch (Exception exception) { var error = exception; testResult = "ExceptionTestFor_EditTask_FailWithException=" + "True"; // Write test case result in text file fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_EditTask_FailWithException", expectedOutput = "True", weight = 2, mandatory = "True", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } }
static public void CreateNew(cases newCase) { using (var db = new StudiaProjektBazyDanychEntities()) { db.cases.Add(newCase); db.SaveChanges(); } }
public ActionResult DeleteConfirmed(int id) { cases cases = db.casess.Find(id); db.casess.Remove(cases); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task SQL_File_FileCaseFindMUId_doesFindMUId() { Random rnd = new Random(); sites site1 = await testHelpers.CreateSite("MySite", 22); DateTime cl1_Ca = DateTime.Now; DateTime cl1_Ua = DateTime.Now; check_lists cl1 = await testHelpers.CreateTemplate(cl1_Ca, cl1_Ua, "template1", "template_desc", "", "", 1, 1); string guid = Guid.NewGuid().ToString(); DateTime c1_ca = DateTime.Now.AddDays(-9); DateTime c1_da = DateTime.Now.AddDays(-8).AddHours(-12); DateTime c1_ua = DateTime.Now.AddDays(-8); workers worker = await testHelpers.CreateWorker("*****@*****.**", "Arne", "Jensen", 21); site_workers site_workers = await testHelpers.CreateSiteWorker(55, site1, worker); units unit = await testHelpers.CreateUnit(48, 49, site1, 348); string microtingUId = Guid.NewGuid().ToString(); string microtingCheckId = Guid.NewGuid().ToString(); cases aCase1 = await testHelpers.CreateCase("case1UId", cl1, c1_ca, "custom1", c1_da, worker, rnd.Next(1, 255), rnd.Next(1, 255), site1, 1, "caseType1", unit, c1_ua, 1, worker, Constants.WorkflowStates.Created); uploaded_data ud = new uploaded_data { Checksum = "checksum1", Extension = "extension", CurrentFile = "currentFile1", UploaderId = 223, UploaderType = "uploader_type", FileLocation = "url", FileName = "fileName" }; dbContext.uploaded_data.Add(ud); await dbContext.SaveChangesAsync().ConfigureAwait(false); field_values fVs = new field_values { UploadedDataId = ud.Id, CaseId = aCase1.Id }; dbContext.field_values.Add(fVs); await dbContext.SaveChangesAsync().ConfigureAwait(false); // Act await sut.FileCaseFindMUId("url"); Assert.NotNull(fVs); Assert.AreEqual(fVs.CaseId, aCase1.Id); }
public async Task BoundaryTestFor_ValidMobileNumberLength() { try { bool isMobile = false; if (_user.Mobile != 0) { if (_user.Mobile.ToString().Length == 10) { isMobile = true; } if (isMobile == true) { var result = _userService.CreateNewUser(_user); testResult = "BoundaryTestFor_ValidMobileNumberLength=" + "True"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Boundary", Name = "TestFor_ValidMobileNumberLength", expectedOutput = "True", weight = 5, mandatory = "True", desc = "expecting to create new user after validating mobile number length as 10" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } } else { Assert.True(isMobile); } } catch (Exception exception) { var res = exception.Message; testResult = "BoundaryTestFor_ValidMobileNumberLength=" + "False"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Boundary", Name = "TestFor_ValidMobileNumberLength", expectedOutput = "False", weight = 1, mandatory = "False", desc = "expecting to create new user after validating mobile number length as 10 but fail" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } }
public async Task BoundaryTestFor_ValidEmail() { try { bool isEmail = false; //_userRepository.Setup(repo => repo.CreateNewUser(_user)).ReturnsAsync(_user); if (_user.Email != "") { Regex regex = new Regex(@"[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$"); isEmail = regex.IsMatch(_user.Email); if (isEmail == true) { var result = _userService.CreateNewUser(_user); testResult = "BoundaryTestFor_ValidEmail=" + "True"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Boundary", Name = "TestFor_ValidEmail", expectedOutput = "True", weight = 5, mandatory = "True", desc = "expecting to create new user after validating email Id" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } } else { Assert.True(isEmail); } } catch (Exception exception) { var res = exception.Message; testResult = "BoundaryTestFor_ValidEmail=" + "False"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Boundary", Name = "TestFor_ValidEmail", expectedOutput = "False", weight = 1, mandatory = "False", desc = "expecting to create new user after validating email Id but fail" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } }
static public void AddCasesToReclamation(cases temporaryCase, int amount) { using (var db = new StudiaProjektBazyDanychEntities()) { LocalOrder.cases = db.cases.SingleOrDefault(t => t.id == temporaryCase.id); LocalOrder.id_case = LocalOrder.cases.id; LocalOrder.case_amount = amount; } }
public String LineCreate(string fkidx, casesline line) { cases header = db.casess.Find(Convert.ToInt32(fkidx)); line.cases = header; db.caseslines.Add(line); db.SaveChanges(); return(""); }
static public void AddCaseToOrder(cases temporaryCase, int amount) { using (var db = new StudiaProjektBazyDanychEntities()) { var DBCase = db.cases.SingleOrDefault(t => t.id == temporaryCase.id); LocalOrder.cases = DBCase; LocalOrder.case_amount = amount; } }
public async Task BoundaryTestFor_BillTitleAsync() { try { bool validBillTitle = false; if (_bill.Title != "") { //Action var result = await _billService.SaveBillAsync(_bill); validBillTitle = true; //Write test result in text file String testResult = "BoundaryTestFor_BillTitleAsync=" + "True"; fileUtility.WriteTestCaseResuItInText(testResult); //Write test result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Boundary", Name = "BoundaryTestFor_BillTitleAsync", expectedOutput = "True", weight = 2, mandatory = "True", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } //Assert Assert.True(validBillTitle); } catch (Exception ex) { var error = ex; String testResult = "BoundaryTestFor_BillTitleAsync = False"; fileUtility.WriteTestCaseResuItInText(testResult); if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Boundary", Name = "BoundaryTestFor_BillTitleAsync", expectedOutput = "False", weight = 0, mandatory = "False", desc = "na" }; await new FileUtility().WriteTestCaseResuItInXML(newcase); } } }
static public void AddCaseToOrder(cases temporaryCase, int amount) { LocalOrder.cases = new cases() { model = temporaryCase.model, price = temporaryCase.price, amount = amount, image_source = temporaryCase.image_source, description = temporaryCase.description }; }
public async Task ExceptionTestFor_AddNewSkill_Fail() { try { _skill = null; var result = await _skillService.AddNewSkill(_skill); if (result == "New Skill Added") { testResult = "ExceptionTestFor_AddNewSkill_Fail=" + "False"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_AddNewSkill_Fail", expectedOutput = "False", weight = 5, mandatory = "False", desc = "na" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } else { Assert.NotEqual("New Skill Added", result); } } catch (Exception exception) { var res = exception.Message; testResult = "ExceptionTestFor_AddNewSkill_Fail=" + "True"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_AddNewSkill_Fail", expectedOutput = "True", weight = 5, mandatory = "True", desc = "na" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } }
public async Task ExceptionTestFor_RemoveUser_Fail() { try { _user = null; var result = await _userService.RemoveUser(_user.FirstName, _user.LastName); if (result == 1) { testResult = "ExceptionTestFor_RemoveUser_Fail=" + "False"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_RemoveUser_Fail", expectedOutput = "False", weight = 5, mandatory = "False", desc = "allows to delete existing user and expecting 1 " }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } else { Assert.NotEqual(1, result); } } catch (Exception exception) { var res = exception.Message; testResult = "ExceptionTestFor_RemoveUser_Fail=" + "True"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_RemoveUser_Fail", expectedOutput = "True", weight = 1, mandatory = "True", desc = "allows to delete existing user and expecting 1 but throw exception" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } }
public async Task ExceptionTestFor_SearchUserBySkillRange_Fail() { try { int range = 0; var result = await _userService.SearchUserBySkillRange(0, 0) as List <User>; if (result.Count != 0) { testResult = "ExceptionTestFor_SearchUserBySkillRange_Fail=" + "False"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_SearchUserBySkillRange_Fail", expectedOutput = "False", weight = 1, mandatory = "False", desc = "na " }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } else { Assert.NotEmpty(result); } } catch (Exception exception) { var res = exception.Message; testResult = "ExceptionTestFor_SearchUserBySkillRange_Fail=" + "True"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_SearchUserBySkillRange_Fail", expectedOutput = "True", weight = 5, mandatory = "True", desc = "na" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } }
public async Task ExceptionTestFor_CreateNewUser_Fail() { try { _user = null; var result = await _userService.CreateNewUser(_user); if (result == "New User Register") { testResult = "ExceptionTestFor_CreateNewUser_Fail=" + "False"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_CreateNewUser_Fail", expectedOutput = "False", weight = 5, mandatory = "False", desc = "allows to create new user and return success message" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } else { Assert.NotEqual("New User Register", result); } } catch (Exception exception) { var res = exception.Message; testResult = "ExceptionTestFor_CreateNewUser_Fail=" + "True"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_CreateNewUser_Fail", expectedOutput = "True", weight = 5, mandatory = "True", desc = "allows to create new user and expecting success message but throw exception" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } }
public async Task BusinessTestFor_EditSkill_Possitive() { try { _skill.SkillLevel = SkillLevel.Expert; _skill.SkillTotalExperiance = 10; var result = await _skillService.EditSkill(_skill); if (result == 1) { testResult = "BusinessTestFor_EditSkill_Possitive=" + "True"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Business", Name = "BusinessTestFor_EditSkill_Possitive", expectedOutput = "True", weight = 5, mandatory = "True", desc = "na" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } else { Assert.Equal(1, result); } } catch (Exception exception) { var res = exception.Message; testResult = "BusinessTestFor_EditSkill_Possitive=" + "False"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Business", Name = "BusinessTestFor_EditSkill_Possitive", expectedOutput = "False", weight = 5, mandatory = "False", desc = "na" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } }
public async Task ExceptionTestFor_SearchUserByMobileNumber_Fail() { try { _user.Mobile = 0; var result = await _userService.SearchUserByMobile(_user.Mobile); if (result != null) { testResult = "ExceptionTestFor_SearchUserByMobileNumber_Fail=" + "False"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_SearchUserByMobileNumber_Fail", expectedOutput = "False", weight = 1, mandatory = "False", desc = "na " }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } else { Assert.NotNull(result); } } catch (Exception exception) { var res = exception.Message; testResult = "ExceptionTestFor_SearchUserByMobileNumber_Fail=" + "True"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Exception", Name = "ExceptionTestFor_SearchUserByMobileNumber_Fail", expectedOutput = "True", weight = 5, mandatory = "True", desc = "na" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } }