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 BusinessTestFor_AddNewSkill_Possitive() { try { var result = await _skillService.AddNewSkill(_skill); if (result == "New Skill Added") { testResult = "BusinessTestFor_AddNewSkill_Possitive=" + "True"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Business", Name = "BusinessTestFor_AddNewSkill_Possitive", expectedOutput = "True", weight = 5, mandatory = "True", desc = "allows to add new skill and return success message" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } else { Assert.Equal("New Skill Added", result); } } catch (Exception exception) { var res = exception.Message; testResult = "BusinessTestFor_AddNewSkill_Possitive=" + "False"; fileUtility.WriteTestCaseResuItInText(testResult); // Write test case result in xml file if (config["env"] == "development") { cases newcase = new cases { TestCaseType = "Business", Name = "BusinessTestFor_AddNewSkill_Possitive", expectedOutput = "False", weight = 5, mandatory = "False", desc = "expected to add new skill and return success message but fail" }; await fileUtility.WriteTestCaseResuItInXML(newcase); } } }
public async Task <ActionResult <String> > NewSkill(Skill skill) { try { //Business logic to call user servic method which returns success message after creating new skill var result = await _skillService.AddNewSkill(skill); return(result); } catch (Exception exception) { return(BadRequest(exception.ToString())); } }